File tree 2 files changed +31
-1
lines changed
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ class Config extends \Magento\PageCache\Model\Config
45
45
/**
46
46
* Cache types
47
47
*/
48
- const FASTLY = ' fastly ' ;
48
+ const FASTLY = 42 ;
49
49
50
50
/**
51
51
* Magento module prefix used for naming vcl snippets, condition and request
Original file line number Diff line number Diff line change 18
18
* @copyright Copyright (c) 2016 Fastly, Inc. (http://www.fastly.com)
19
19
* @license BSD, see LICENSE_FASTLY_CDN.txt
20
20
*/
21
+
21
22
namespace Fastly \Cdn \Model \PageCache ;
22
23
23
24
use \Magento \PageCache \Model \Config ;
36
37
*/
37
38
class ConfigPlugin
38
39
{
40
+ protected $ _scopeConfig ;
41
+
42
+ /**
43
+ * ConfigPlugin constructor.
44
+ *
45
+ * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
46
+ */
47
+ public function __construct (\Magento \Framework \App \Config \ScopeConfigInterface $ scopeConfig )
48
+ {
49
+ $ this ->_scopeConfig = $ scopeConfig ;
50
+ }
51
+
39
52
/**
40
53
* Return cache type "Varnish" if Fastly is configured.
41
54
*
@@ -53,4 +66,21 @@ public function afterGetType(Config $config, $result)
53
66
}
54
67
return $ result ;
55
68
}
69
+
70
+ /**
71
+ * Change return value from string to int, 'fastly' is old value
72
+ *
73
+ * @param Config $config
74
+ * @param callable $proceed
75
+ * @return string
76
+ */
77
+ public function aroundGetType (Config $ config , callable $ proceed )
78
+ {
79
+ if ($ this ->_scopeConfig ->getValue (Config::XML_PAGECACHE_TYPE ) === 'fastly ' ) {
80
+ $ result = \Fastly \Cdn \Model \Config::FASTLY ;
81
+ } else {
82
+ $ result = $ proceed ();
83
+ }
84
+ return $ result ;
85
+ }
56
86
}
You can’t perform that action at this time.
0 commit comments