File tree Expand file tree Collapse file tree 6 files changed +60
-2
lines changed
app/code/Magento/PageCache
Block/System/Config/Form/Field/Export
Controller/Adminhtml/PageCache Expand file tree Collapse file tree 6 files changed +60
-2
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ namespace Magento \PageCache \Block \System \Config \Form \Field \Export ;
7
+
8
+ /**
9
+ * Class Export
10
+ */
11
+ class Varnish6 extends \Magento \PageCache \Block \System \Config \Form \Field \Export
12
+ {
13
+ /**
14
+ * Return Varnish version to this class
15
+ *
16
+ * @return int
17
+ */
18
+ public function getVarnishVersion ()
19
+ {
20
+ return 6 ;
21
+ }
22
+ }
Original file line number Diff line number Diff line change @@ -50,6 +50,9 @@ public function execute()
50
50
$ fileName = 'varnish.vcl ' ;
51
51
$ varnishVersion = $ this ->getRequest ()->getParam ('varnish ' );
52
52
switch ($ varnishVersion ) {
53
+ case 6 :
54
+ $ content = $ this ->config ->getVclFile (\Magento \PageCache \Model \Config::VARNISH_6_CONFIGURATION_PATH );
55
+ break ;
53
56
case 5 :
54
57
$ content = $ this ->config ->getVclFile (\Magento \PageCache \Model \Config::VARNISH_5_CONFIGURATION_PATH );
55
58
break ;
Original file line number Diff line number Diff line change @@ -49,6 +49,11 @@ class Config
49
49
*/
50
50
protected $ _scopeConfig ;
51
51
52
+ /**
53
+ * XML path to Varnish 5 config template path
54
+ */
55
+ const VARNISH_6_CONFIGURATION_PATH = 'system/full_page_cache/varnish6/path ' ;
56
+
52
57
/**
53
58
* XML path to Varnish 5 config template path
54
59
*/
@@ -145,8 +150,16 @@ public function getVclFile($vclTemplatePath)
145
150
self ::XML_VARNISH_PAGECACHE_DESIGN_THEME_REGEX ,
146
151
\Magento \Store \Model \ScopeInterface::SCOPE_STORE
147
152
);
148
-
149
- $ version = $ vclTemplatePath === self ::VARNISH_5_CONFIGURATION_PATH ? 5 : 4 ;
153
+ switch ($ vclTemplatePath ) {
154
+ case self ::VARNISH_6_CONFIGURATION_PATH :
155
+ $ version = 6 ;
156
+ break ;
157
+ case self ::VARNISH_5_CONFIGURATION_PATH :
158
+ $ version = 5 ;
159
+ break ;
160
+ default :
161
+ $ version = 4 ;
162
+ }
150
163
$ sslOffloadedHeader = $ this ->_scopeConfig ->getValue (
151
164
\Magento \Framework \HTTP \PhpEnvironment \Request::XML_PATH_OFFLOADER_HEADER
152
165
);
Original file line number Diff line number Diff line change 15
15
16
16
class VclTemplateLocator implements VclTemplateLocatorInterface
17
17
{
18
+ /**
19
+ * XML path to Varnish 5 config template path
20
+ */
21
+ const VARNISH_6_CONFIGURATION_PATH = 'system/full_page_cache/varnish6/path ' ;
22
+
18
23
/**
19
24
* XML path to Varnish 5 config template path
20
25
*/
@@ -35,12 +40,18 @@ class VclTemplateLocator implements VclTemplateLocatorInterface
35
40
*/
36
41
const VARNISH_SUPPORTED_VERSION_5 = '5 ' ;
37
42
43
+ /**
44
+ *
45
+ */
46
+ const VARNISH_SUPPORTED_VERSION_6 = '6 ' ;
47
+
38
48
/**
39
49
* @var array
40
50
*/
41
51
private $ supportedVarnishVersions = [
42
52
self ::VARNISH_SUPPORTED_VERSION_4 => self ::VARNISH_4_CONFIGURATION_PATH ,
43
53
self ::VARNISH_SUPPORTED_VERSION_5 => self ::VARNISH_5_CONFIGURATION_PATH ,
54
+ self ::VARNISH_SUPPORTED_VERSION_6 => self ::VARNISH_6_CONFIGURATION_PATH ,
44
55
];
45
56
46
57
/**
Original file line number Diff line number Diff line change 62
62
<field id =" caching_application" >1</field >
63
63
</depends >
64
64
</field >
65
+ <field id =" export_button_version6" type =" button" sortOrder =" 40" showInDefault =" 1" showInWebsite =" 0" showInStore =" 0" >
66
+ <frontend_model >Magento\PageCache\Block\System\Config\Form\Field\Export\Varnish6</frontend_model >
67
+ <depends >
68
+ <field id =" caching_application" >1</field >
69
+ </depends >
70
+ </field >
65
71
<depends >
66
72
<field id =" caching_application" >2</field >
67
73
</depends >
Original file line number Diff line number Diff line change 14
14
</design >
15
15
<system >
16
16
<full_page_cache >
17
+ <varnish6 >
18
+ <path >varnish6.vcl</path >
19
+ </varnish6 >
17
20
<varnish5 >
18
21
<path >varnish5.vcl</path >
19
22
</varnish5 >
You can’t perform that action at this time.
0 commit comments