Varnish_Cache - Version 4.2.0

Version Notes

- fixed issue with form key in Magento CE > 1.8

Download this release

Release Info

Developer Magento Core Team
Extension Varnish_Cache
Version 4.2.0
Comparing to
See all releases


Code changes from version 4.0.5 to 4.2.0

Files changed (42) hide show
  1. README_VARNISH_CACHE.txt +108 -5
  2. app/code/community/Phoenix/VarnishCache/Block/Adminhtml/Cache/Additional.php +1 -1
  3. app/code/community/Phoenix/VarnishCache/Block/Adminhtml/System/Config/Fieldset/RouteTTL.php +1 -1
  4. app/code/community/Phoenix/VarnishCache/Block/Adminhtml/System/Config/Fieldset/Versioninfo.php +1 -1
  5. app/code/community/Phoenix/VarnishCache/Block/Cookie/Environment.php +1 -1
  6. app/code/community/Phoenix/VarnishCache/Block/Cookie/Formkey.php +70 -0
  7. app/code/community/Phoenix/VarnishCache/Helper/Cache.php +62 -30
  8. app/code/community/Phoenix/VarnishCache/Helper/Control/Catalog/Category.php +1 -1
  9. app/code/community/Phoenix/VarnishCache/Helper/Control/Catalog/Product.php +1 -1
  10. app/code/community/Phoenix/VarnishCache/Helper/Control/Cms/Page.php +1 -1
  11. app/code/community/Phoenix/VarnishCache/Helper/Data.php +1 -1
  12. app/code/community/Phoenix/VarnishCache/Helper/Esi.php +90 -0
  13. app/code/community/Phoenix/VarnishCache/Model/Catalog/Category/Product.php +1 -1
  14. app/code/community/Phoenix/VarnishCache/Model/Catalog/Product/Relation.php +1 -1
  15. app/code/community/Phoenix/VarnishCache/Model/Cms/Page/Store.php +1 -1
  16. app/code/community/Phoenix/VarnishCache/Model/Control.php +10 -1
  17. app/code/community/Phoenix/VarnishCache/Model/Control/Abstract.php +1 -1
  18. app/code/community/Phoenix/VarnishCache/Model/Control/Catalog/Category.php +1 -1
  19. app/code/community/Phoenix/VarnishCache/Model/Control/Catalog/Product.php +78 -10
  20. app/code/community/Phoenix/VarnishCache/Model/Control/Cms/Page.php +1 -1
  21. app/code/community/Phoenix/VarnishCache/Model/Observer.php +36 -4
  22. app/code/community/Phoenix/VarnishCache/Model/Processor.php +1 -1
  23. app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Catalog/Category/Product.php +1 -1
  24. app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Catalog/Category/Product/Collection.php +1 -1
  25. app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Catalog/Product/Relation/Collection.php +1 -1
  26. app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Cms/Page/Store.php +1 -1
  27. app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Cms/Page/Store/Collection.php +1 -1
  28. app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Core/Url/Rewrite/Collection.php +1 -1
  29. app/code/community/Phoenix/VarnishCache/controllers/Adminhtml/VarnishCacheController.php +1 -1
  30. app/code/community/Phoenix/VarnishCache/etc/config.xml +19 -2
  31. app/code/community/Phoenix/VarnishCache/etc/default_3.0.vcl +130 -45
  32. app/code/community/Phoenix/VarnishCache/etc/system.xml +1 -1
  33. app/code/community/Phoenix/VarnishCache/etc/vars.vcl +150 -0
  34. app/code/community/Phoenix/VarnishCache/sql/varnishcache_setup/install-4.0.0.php +1 -1
  35. app/design/adminhtml/default/default/layout/varnishcache.xml +1 -1
  36. app/design/adminhtml/default/default/template/varnishcache/cache/additional.phtml +1 -1
  37. app/design/frontend/base/default/layout/varnishcache.xml +3 -2
  38. app/design/frontend/base/default/template/varnishcache/cookie/environment.phtml +1 -1
  39. app/design/frontend/base/default/template/varnishcache/cookie/formkey.phtml +40 -0
  40. app/etc/modules/Phoenix_VarnishCache.xml +1 -1
  41. app/etc/varnishcache.xml +1 -1
  42. package.xml +5 -6
README_VARNISH_CACHE.txt CHANGED
@@ -20,6 +20,9 @@ Table of contents
20
  4.2 Varnish Cache (VCL)
21
  4.3 PageCache Crawler
22
  4.4 ESI
 
 
 
23
  5. Cache cleaning, PURGE requests
24
  6. VCL Design Exceptions
25
  7. Troubleshooting
@@ -113,12 +116,17 @@ configuration directory (/etc/varnish/). If you subscribed to the Enterprise Edi
113
  of the module you find and improved VCL file with ESI support (see section 4.4) here:
114
  app/code/local/Phoenix/VarnishCacheEnterprise/etc/esi_3.0.vcl.
115
 
 
 
 
 
 
116
  We also recommend you check Varnish's startup parameters. Depending on your OS the
117
  location of your startup settings might differ. For RHEL/CentOS e.g. you find it under
118
  /etc/sysconfig/varnish.
119
  To make ESI run smoothly add this startup parameters:
120
 
121
- -p esi_syntax=0x1
122
  to make varnish not yell at you cause of "no valid XML"
123
 
124
  -p shm_reclen=4096
@@ -136,6 +144,9 @@ Proceed with the configuration.
136
  4. Configuration
137
  ================
138
 
 
 
 
139
  4.1 PageCache module
140
  ====================
141
 
@@ -157,7 +168,6 @@ should be set to "Yes" globally even if you like to deactivate the
157
  module for certain websites or store views. Otherwise the cleaning
158
  options on the Cache Magement page won’t be available.
159
 
160
-
161
  Varnish servers
162
  ---------------
163
  Add your Varnish server(s) domains or IPs separated by semicolon.
@@ -289,6 +299,16 @@ Magento and Varnish right away you can of course adjust it to your needs
289
  if necessary. Please see VCL documentation at
290
  http://www.varnish-cache.org/docs/3.0/reference/vcl.html.
291
 
 
 
 
 
 
 
 
 
 
 
292
  When putting Varnish in front of your web server (backend) you will have
293
  to change the web server’s port which is normally port 80. We recommend
294
  to change its’ listen port to 8080 which is already configured in the
@@ -342,8 +362,8 @@ Defines cron run schedule. This field should contain a valid cron expression
342
  string like "0 0 * * *" for daily run or "0 * * * *" for hourly run. For more
343
  information read http://en.wikipedia.org/wiki/Cron
344
 
345
- 4.4 ESI (Enterprise Edition only)
346
- =================================
347
 
348
  Edge Side Includes (ESI) is implemented in Varnish as a subset of the W3C
349
  definition (http://www.w3.org/TR/esi-lang) and supports esi:include and
@@ -360,6 +380,15 @@ compatible with ESI and therefore has to be turned of (System -> Cache Managemen
360
  as it is based on the same application logic (replacing original blocks with
361
  placeholders and compile the actual page content on the fly).
362
 
 
 
 
 
 
 
 
 
 
363
  The enterprise version comes preconfigured with ESI handling for these blocks:
364
  - top links
365
  - welcome message
@@ -388,7 +417,7 @@ section.
388
 
389
  ESI Strict Rendering
390
  --------------------
391
- When set to ""No"" block logic gets simplified to get better hit rates. However the content might slightly
392
  differ from native Magento block. This affects especially to the "recently viewed products" and "recently compared
393
  products" block which natively filters the list of viewed or compared products.
394
 
@@ -412,6 +441,65 @@ ESI Passthrough
412
  Pass all ESI requests through Varnish to the backend without caching them. This is a shortcut to set the TTL of ESI
413
  blocks temporarily to 0 seconds.
414
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
415
 
416
  5. Cache cleaning, PURGE requests
417
  =================================
@@ -581,6 +669,21 @@ varnishlog and make sure the Vary header only looks like this:
581
 
582
  8. Changelog
583
  ============
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
584
  4.0.5
585
  - fixed issue with caching of store switching requests
586
 
20
  4.2 Varnish Cache (VCL)
21
  4.3 PageCache Crawler
22
  4.4 ESI
23
+ 4.4.1 Form Key Handling
24
+ 4.4.2 Enterprise Edition Features
25
+ 4.5 GeoIP handling
26
  5. Cache cleaning, PURGE requests
27
  6. VCL Design Exceptions
28
  7. Troubleshooting
116
  of the module you find and improved VCL file with ESI support (see section 4.4) here:
117
  app/code/local/Phoenix/VarnishCacheEnterprise/etc/esi_3.0.vcl.
118
 
119
+ In case you use EE >= 1.13 or CE >= 1.8 and you want to make use of frontend
120
+ form keys you have to enable ESI within varnish.
121
+ Make sure you copy the file vars.vcl to the Varnish configuration directory
122
+ as well. It should be located in the same directory as the default.vcl.
123
+
124
  We also recommend you check Varnish's startup parameters. Depending on your OS the
125
  location of your startup settings might differ. For RHEL/CentOS e.g. you find it under
126
  /etc/sysconfig/varnish.
127
  To make ESI run smoothly add this startup parameters:
128
 
129
+ -p esi_syntax=0x03
130
  to make varnish not yell at you cause of "no valid XML"
131
 
132
  -p shm_reclen=4096
144
  4. Configuration
145
  ================
146
 
147
+ This section handles the differnet configuration option for the module
148
+ as well as settings that have to be done on the server side.
149
+
150
  4.1 PageCache module
151
  ====================
152
 
168
  module for certain websites or store views. Otherwise the cleaning
169
  options on the Cache Magement page won’t be available.
170
 
 
171
  Varnish servers
172
  ---------------
173
  Add your Varnish server(s) domains or IPs separated by semicolon.
299
  if necessary. Please see VCL documentation at
300
  http://www.varnish-cache.org/docs/3.0/reference/vcl.html.
301
 
302
+ In the "etc" subdirectory you can find different vcl files:
303
+ - default_3.0.vcl
304
+ - vars.vcl
305
+ or with the Enterprise Edition:
306
+ - esi_3.0.vcl
307
+ - esi_geo.vcl (if you want to use the geoip feature)
308
+ - vars.vcl
309
+
310
+ You have to copy all the needed vcl files to your varnish config directory.
311
+
312
  When putting Varnish in front of your web server (backend) you will have
313
  to change the web server’s port which is normally port 80. We recommend
314
  to change its’ listen port to 8080 which is already configured in the
362
  string like "0 0 * * *" for daily run or "0 * * * *" for hourly run. For more
363
  information read http://en.wikipedia.org/wiki/Cron
364
 
365
+ 4.4 ESI
366
+ =======
367
 
368
  Edge Side Includes (ESI) is implemented in Varnish as a subset of the W3C
369
  definition (http://www.w3.org/TR/esi-lang) and supports esi:include and
380
  as it is based on the same application logic (replacing original blocks with
381
  placeholders and compile the actual page content on the fly).
382
 
383
+ 4.4.1 Form Key Handling
384
+ -----------------------
385
+ As with version CE 1.8 and EE 1.13 Magento introduced form keys. In case you want
386
+ to use ESI with a version that uses formkeys you have to make that the vars.vcl file
387
+ is in the correct location.
388
+
389
+ 4.4.2 Enterprise Edition Features
390
+ ---------------------------------
391
+
392
  The enterprise version comes preconfigured with ESI handling for these blocks:
393
  - top links
394
  - welcome message
417
 
418
  ESI Strict Rendering
419
  --------------------
420
+ When set to "No" block logic gets simplified to get better hit rates. However the content might slightly
421
  differ from native Magento block. This affects especially to the "recently viewed products" and "recently compared
422
  products" block which natively filters the list of viewed or compared products.
423
 
441
  Pass all ESI requests through Varnish to the backend without caching them. This is a shortcut to set the TTL of ESI
442
  blocks temporarily to 0 seconds.
443
 
444
+ 4.5 GeoIP handling (Enterprise Edition only)
445
+ =================================
446
+
447
+ GeoIP handling will get the country of a web client based on it's IP address.
448
+ This feature can be used to either automatically redirect customers to the store matching their
449
+ country or to show them a dialog to select the desired store themselves.
450
+
451
+ prerequisites
452
+ ------------
453
+ You have to install the MaxMind GeoIP database alongside your varnish server. You can get it here
454
+ http://www.maxmind.com/de/geolocation_landing or install it with your usual Linux package system.
455
+ As the vcl configuration that comes with this module is based on the MaxMind c-api, only this library is supported.
456
+
457
+ On most Linux package managements the libraries are called: GeoIP and GeoIP-devel.
458
+
459
+ To make use of then GeoIP handling ESI has to be enabled.
460
+ To enable GeoIP handling go to System -> Configuration -> "PageCache powered by Varnish Enterprise"
461
+ and open the "GeoIP Settings" tab and choose "Yes" with "Enable GeoIP".
462
+ Make sure to be on store configuration scope.
463
+
464
+ varnish start parameters
465
+ ------------------------
466
+ To make Varnish use the GeoIP library add the following parameter to the options when starting varnishd
467
+ -p 'cc_command=exec cc -fpic -shared -Wl,-x -o %o %s -lGeoIP'
468
+
469
+ general behaviour
470
+ -----------------
471
+ The module will set a cookie with the name "pagegache-geoip-processed" after a redirect or when a dialog is displayed.
472
+ If this cookie is set on the customer side this module will take no action at all as we presume the customer either
473
+ saw (and maybe interacted with) the popup or was automatically redirected to the matching store.
474
+
475
+ Show a dialog to select target store
476
+ ------------------------------------
477
+ When set to "yes" your customers will be presented with a dialog. When set to "no" your customers will be redirected.
478
+ The action performed depends on two variables:
479
+ - the current store
480
+ - the country of your customer
481
+ To configure the dialog or the redirect url you have to switch to store scope and add mappings for the countries you
482
+ want to redirect/inform.
483
+ All country mappings use ISO 3166-1-alpha-2 codes.
484
+
485
+ Mapping for static CMS blocks
486
+ -----------------------------
487
+ For every country you want to show a dialog you have to enter a country code an select a static cms block to display.
488
+ This module comes with predefined cms blocks to be a base for your custom development.
489
+ The modal window itself can be customized by editing the template file under
490
+ /frontend/base/default/template/varnishcacheenterprise/page/geoipdialog.phtml
491
+
492
+ Mapping for redirects
493
+ ---------------------
494
+ For every country you want to redirect to a specific store you have to enter a country code an select a target store.
495
+
496
+ Prevent redirect or static blocks to be shown
497
+ ---------------------------------------------
498
+ You probably don't want to redirect your customers to another store if the country of your visitor matches the current
499
+ store.
500
+ To prevent redirects you have to add a mapping using the country code of that store and leave the other field empty.
501
+ This way, if your customer is in the "right" store (based on the country) no geoip based action will be triggered.
502
+
503
 
504
  5. Cache cleaning, PURGE requests
505
  =================================
669
 
670
  8. Changelog
671
  ============
672
+ 4.2.0
673
+ - added support for frontend form keys, introduced in EE 1.13 and CE 1.8
674
+
675
+ 4.1.1
676
+ - fixed issue with esi tags being rendered with POST requests
677
+
678
+ 4.1.0
679
+ - added GeoIP handling
680
+
681
+ 4.0.7
682
+ - added ESI block for cookie notices
683
+
684
+ 4.0.6
685
+ - fixed minor issue with vcl
686
+
687
  4.0.5
688
  - fixed issue with caching of store switching requests
689
 
app/code/community/Phoenix/VarnishCache/Block/Adminhtml/Cache/Additional.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Block/Adminhtml/System/Config/Fieldset/RouteTTL.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Block/Adminhtml/System/Config/Fieldset/Versioninfo.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Block/Cookie/Environment.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Block/Cookie/Formkey.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PageCache powered by Varnish
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to support@phoenix-media.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Phoenix
16
+ * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Phoenix_VarnishCache_Block_Cookie_Formkey extends Mage_Core_Block_Template
22
+ {
23
+ protected function _construct()
24
+ {
25
+ // set default cache lifetime and cache tags
26
+ $this->addData(array(
27
+ 'cache_lifetime' => false
28
+ ));
29
+ }
30
+
31
+
32
+ /**
33
+ * Return environment cookie name
34
+ *
35
+ * @return string
36
+ */
37
+ public function getCookieName()
38
+ {
39
+ return Phoenix_VarnishCache_Helper_Esi::FORMKEY_COOKIE;
40
+ }
41
+
42
+ /**
43
+ * Return the form key esi tag
44
+ *
45
+ * @return string
46
+ */
47
+ public function getFormKeyValue()
48
+ {
49
+ // try to use form key from session
50
+ $session = Mage::getSingleton('core/session');
51
+ $formKey = $session->getData('_form_key');
52
+
53
+ // or create new one via esi
54
+ if(empty($formKey)) {
55
+ $formKey = Mage::helper('varnishcache/esi')->getFormKeyEsiTag();
56
+ }
57
+
58
+ return $formKey;
59
+ }
60
+
61
+ /**
62
+ * Return the cookie lifetime
63
+ *
64
+ * @return int
65
+ */
66
+ public function getCookieLifetime()
67
+ {
68
+ return Mage::getModel('core/cookie')->getLifetime() * 1000;
69
+ }
70
+ }
app/code/community/Phoenix/VarnishCache/Helper/Cache.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
@@ -106,12 +106,31 @@ class Phoenix_VarnishCache_Helper_Cache extends Mage_Core_Helper_Abstract
106
  // renew no-cache cookie
107
  $this->setNoCacheCookie(true);
108
 
109
- // disable page caching for POSTs and no_cache parameters
110
- if ($request->isPost() || $request->getParam('no_cache') || $request->getParam('___store') ||
111
- !in_array(Mage::app()->getResponse()->getHttpResponseCode(), array(200, 301, 404))) {
 
 
 
 
 
 
 
 
112
  return $this->setNoCacheHeader();
113
  }
114
 
 
 
 
 
 
 
 
 
 
 
 
115
  // disable page caching because of configuration
116
  if (Mage::getStoreConfigFlag(self::XML_PATH_VARNISH_CACHE_DISABLE_CACHING)) {
117
  return $this->setNoCacheHeader();
@@ -181,6 +200,7 @@ class Phoenix_VarnishCache_Helper_Cache extends Mage_Core_Helper_Abstract
181
  */
182
  public function setNoCacheCookie($renewOnly = false)
183
  {
 
184
  if ($this->getCookie()->get(self::NO_CACHE_COOKIE)) {
185
  $this->getCookie()->renew(self::NO_CACHE_COOKIE);
186
  } elseif (!$renewOnly) {
@@ -270,37 +290,49 @@ class Phoenix_VarnishCache_Helper_Cache extends Mage_Core_Helper_Abstract
270
  */
271
  public function getStoreDomainList($storeId = 0, $seperator = '|')
272
  {
273
- $storeIds = array($storeId);
 
274
 
275
- // if $store is empty or 0 get all store ids
276
- if (empty($storeId)) {
277
- $storeIds = Mage::getResourceModel('core/store_collection')->getAllIds();
278
- }
 
 
 
 
 
279
 
280
- $domains = array();
281
- $urlTypes = array(
282
- Mage_Core_Model_Store::URL_TYPE_LINK,
283
- Mage_Core_Model_Store::URL_TYPE_DIRECT_LINK,
284
- Mage_Core_Model_Store::URL_TYPE_WEB,
285
- Mage_Core_Model_Store::URL_TYPE_SKIN,
286
- Mage_Core_Model_Store::URL_TYPE_JS,
287
- Mage_Core_Model_Store::URL_TYPE_MEDIA
288
- );
289
- foreach ($storeIds as $storeId) {
290
- $store = Mage::getModel('core/store')->load($storeId);
291
-
292
- foreach ($urlTypes as $urlType) {
293
- // get non-secure store domain
294
- $domains[] = Zend_Uri::factory($store->getBaseUrl($urlType, false))->getHost();
295
- // get secure store domain
296
- $domains[] = Zend_Uri::factory($store->getBaseUrl($urlType, true))->getHost();
 
 
 
 
 
 
297
  }
298
- }
299
 
300
- // get only unique values
301
- $domains = array_unique($domains);
 
302
 
303
- return implode($seperator, $domains);
304
  }
305
 
306
  /**
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
106
  // renew no-cache cookie
107
  $this->setNoCacheCookie(true);
108
 
109
+ /**
110
+ * disable page caching
111
+ */
112
+
113
+ // disable page caching for POSTs
114
+ if ($request->isPost()) {
115
+ return $this->setNoCacheHeader();
116
+ }
117
+
118
+ // disable page caching for due to HTTP status codes
119
+ if (!in_array(Mage::app()->getResponse()->getHttpResponseCode(), array(200, 301, 404))) {
120
  return $this->setNoCacheHeader();
121
  }
122
 
123
+ // disable page caching for certain GET parameters
124
+ $noCacheGetParams = array(
125
+ 'no_cache', // explicit
126
+ '___store' // language switch
127
+ );
128
+ foreach($noCacheGetParams as $param) {
129
+ if($request->getParam($param)) {
130
+ return $this->setNoCacheHeader();
131
+ }
132
+ }
133
+
134
  // disable page caching because of configuration
135
  if (Mage::getStoreConfigFlag(self::XML_PATH_VARNISH_CACHE_DISABLE_CACHING)) {
136
  return $this->setNoCacheHeader();
200
  */
201
  public function setNoCacheCookie($renewOnly = false)
202
  {
203
+
204
  if ($this->getCookie()->get(self::NO_CACHE_COOKIE)) {
205
  $this->getCookie()->renew(self::NO_CACHE_COOKIE);
206
  } elseif (!$renewOnly) {
290
  */
291
  public function getStoreDomainList($storeId = 0, $seperator = '|')
292
  {
293
+ return implode($seperator, $this->_getStoreDomainsArray($storeId));
294
+ }
295
 
296
+ /**
297
+ * @param int $storeId
298
+ *
299
+ * @return array
300
+ */
301
+ protected function _getStoreDomainsArray($storeId = 0)
302
+ {
303
+ if (!isset($this->_storeDomainArray[$storeId])) {
304
+ $this->_storeDomainArray[$storeId] = array();
305
 
306
+ $storeIds = array($storeId);
307
+ // if $store is empty or 0 get all store ids
308
+ if (empty($storeId)) {
309
+ $storeIds = Mage::getResourceModel('core/store_collection')->getAllIds();
310
+ }
311
+
312
+ $urlTypes = array(
313
+ Mage_Core_Model_Store::URL_TYPE_LINK,
314
+ Mage_Core_Model_Store::URL_TYPE_DIRECT_LINK,
315
+ Mage_Core_Model_Store::URL_TYPE_WEB,
316
+ Mage_Core_Model_Store::URL_TYPE_SKIN,
317
+ Mage_Core_Model_Store::URL_TYPE_JS,
318
+ Mage_Core_Model_Store::URL_TYPE_MEDIA
319
+ );
320
+ foreach ($storeIds as $_storeId) {
321
+ $store = Mage::getModel('core/store')->load($_storeId);
322
+
323
+ foreach ($urlTypes as $urlType) {
324
+ // get non-secure store domain
325
+ $this->_storeDomainArray[$storeId][] = Zend_Uri::factory($store->getBaseUrl($urlType, false))->getHost();
326
+ // get secure store domain
327
+ $this->_storeDomainArray[$storeId][] = Zend_Uri::factory($store->getBaseUrl($urlType, true))->getHost();
328
+ }
329
  }
 
330
 
331
+ // get only unique values
332
+ $this->_storeDomainArray[$storeId] = array_unique($this->_storeDomainArray[$storeId]);
333
+ }
334
 
335
+ return $this->_storeDomainArray[$storeId];
336
  }
337
 
338
  /**
app/code/community/Phoenix/VarnishCache/Helper/Control/Catalog/Category.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Helper/Control/Catalog/Product.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Helper/Control/Cms/Page.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Helper/Data.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Helper/Esi.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PageCache powered by Varnish
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to support@phoenix-media.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Phoenix
16
+ * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Phoenix_VarnishCache_Helper_Esi extends Mage_Core_Helper_Abstract
22
+ {
23
+ const ESI_FORMKEY_URL = 'varnishcache/getformkey/';
24
+ const FORMKEY_COOKIE = 'PAGECACHE_FORMKEY';
25
+ const ESI_INCLUDE_OPEN = '<esi:include src="';
26
+ const ESI_INCLUDE_CLOSE = '" />';
27
+
28
+ /**
29
+ * return if used magento version uses form keys
30
+ *
31
+ * @return bool
32
+ */
33
+ public function hasFormKey()
34
+ {
35
+ $session = Mage::getSingleton('core/session');
36
+
37
+ return method_exists($session, 'getFormKey');
38
+ }
39
+
40
+ /**
41
+ * generate esi tag for form keys
42
+ *
43
+ * @return string
44
+ */
45
+ public function getFormKeyEsiTag()
46
+ {
47
+ $url = Mage::getUrl(
48
+ self::ESI_FORMKEY_URL,
49
+ array(
50
+ '_nosid' => true,
51
+ '_secure' => false
52
+ )
53
+ );
54
+ $esiTag = self::ESI_INCLUDE_OPEN . $url . self::ESI_INCLUDE_CLOSE;
55
+
56
+ return $esiTag;
57
+ }
58
+
59
+ /**
60
+ * Replace form key with esi tag
61
+ *
62
+ * @param string $content
63
+ * @return string
64
+ */
65
+ public function replaceFormKey($content)
66
+ {
67
+ /** @var $session Mage_Core_Model_Session */
68
+ $session = Mage::getSingleton('core/session');
69
+
70
+ // replace all occurrences of form key with esi tag
71
+ $content = str_replace(
72
+ $session->getFormKey(),
73
+ $this->getFormKeyEsiTag(),
74
+ $content
75
+ );
76
+
77
+ return $content;
78
+ }
79
+
80
+ /**
81
+ * Return the form key value stored in a cookie
82
+ * or false if it is not set
83
+ *
84
+ * @return string|false
85
+ */
86
+ public function getCookieFormKey()
87
+ {
88
+ return Mage::getSingleton('core/cookie')->get(self::FORMKEY_COOKIE);
89
+ }
90
+ }
app/code/community/Phoenix/VarnishCache/Model/Catalog/Category/Product.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Model/Catalog/Product/Relation.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
  class Phoenix_VarnishCache_Model_Catalog_Product_Relation extends Mage_Core_Model_Abstract
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
  class Phoenix_VarnishCache_Model_Catalog_Product_Relation extends Mage_Core_Model_Abstract
app/code/community/Phoenix/VarnishCache/Model/Cms/Page/Store.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Model/Control.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
@@ -38,6 +38,7 @@ class Phoenix_VarnishCache_Model_Control
38
  const VARNISH_HEADER_HOST = 'X-Purge-Host';
39
  const VARNISH_HEADER_CONTENT_TYPE = 'X-Purge-Content-Type';
40
 
 
41
 
42
  /**
43
  * Get content types as option array
@@ -83,6 +84,14 @@ class Phoenix_VarnishCache_Model_Control
83
  return true;
84
  }
85
 
 
 
 
 
 
 
 
 
86
 
87
  /**
88
  * Process all servers
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
38
  const VARNISH_HEADER_HOST = 'X-Purge-Host';
39
  const VARNISH_HEADER_CONTENT_TYPE = 'X-Purge-Content-Type';
40
 
41
+ const MAX_URL_PATHS_PER_REQUEST = 50;
42
 
43
  /**
44
  * Get content types as option array
84
  return true;
85
  }
86
 
87
+ public function cleanUrlPaths($domains, $urlPaths)
88
+ {
89
+ $urlPaths = array_chunk($urlPaths, self::MAX_URL_PATHS_PER_REQUEST);
90
+ foreach ($urlPaths as $urlPathsChunk) {
91
+ $urlRegexp = '/(' . implode('|', $urlPathsChunk) . ')';
92
+ $this->clean($domains, $urlRegexp);
93
+ }
94
+ }
95
 
96
  /**
97
  * Process all servers
app/code/community/Phoenix/VarnishCache/Model/Control/Abstract.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Model/Control/Catalog/Category.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Model/Control/Catalog/Product.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
@@ -34,36 +34,43 @@ class Phoenix_VarnishCache_Model_Control_Catalog_Product
34
  public function purge(Mage_Catalog_Model_Product $product, $purgeParentProducts = false, $purgeCategories = false)
35
  {
36
  if ($this->_canPurge()) {
37
- $this->_purgeById($product->getId());
 
 
38
  $this->_getSession()->addSuccess(
39
  Mage::helper('varnishcache')->__('Varnish cache for "%s" has been purged.', $product->getName())
40
  );
 
41
  if ($purgeParentProducts) {
42
  // purge parent products
43
  $productRelationCollection = $this->_getProductRelationCollection()
44
  ->filterByChildId($product->getId());
45
  foreach ($productRelationCollection as $productRelation) {
46
- $this->_purgeById($productRelation->getParentId());
47
  }
48
  // purge categories of parent products
49
  if ($purgeCategories) {
50
  $categoryProductCollection = $this->_getCategoryProductRelationCollection()
51
  ->filterAllByProductIds($productRelationCollection->getAllIds());
52
- $catalogCacheControl = $this->_getCategoryCacheControl();
53
  foreach ($categoryProductCollection as $categoryProduct) {
54
- $catalogCacheControl->purgeById($categoryProduct->getCategoryId());
55
  }
56
  }
57
  }
 
 
 
58
  if ($purgeCategories) {
59
- $catalogCacheControl = $this->_getCategoryCacheControl();
60
  foreach ($product->getCategoryCollection() as $category) {
61
- $catalogCacheControl->purge($category);
62
  }
63
  $this->_getSession()->addSuccess(
64
  Mage::helper('varnishcache')->__('Varnish cache for the product\'s categories has been purged.')
65
  );
66
  }
 
 
67
  }
68
  return $this;
69
  }
@@ -92,11 +99,72 @@ class Phoenix_VarnishCache_Model_Control_Catalog_Product
92
  {
93
  $collection = $this->_getUrlRewriteCollection()
94
  ->filterAllByProductId($id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  foreach ($collection as $urlRewriteRule) {
96
- $urlRegexp = '/' . $urlRewriteRule->getRequestPath();
97
- $this->_getCacheControl()
98
- ->clean($this->_getStoreDomainList(), $urlRegexp);
99
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  return $this;
101
  }
102
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
34
  public function purge(Mage_Catalog_Model_Product $product, $purgeParentProducts = false, $purgeCategories = false)
35
  {
36
  if ($this->_canPurge()) {
37
+ $idsToPurge = array();
38
+ $categoryIdsToPurge = array();
39
+ $idsToPurge[] = $product->getId();
40
  $this->_getSession()->addSuccess(
41
  Mage::helper('varnishcache')->__('Varnish cache for "%s" has been purged.', $product->getName())
42
  );
43
+
44
  if ($purgeParentProducts) {
45
  // purge parent products
46
  $productRelationCollection = $this->_getProductRelationCollection()
47
  ->filterByChildId($product->getId());
48
  foreach ($productRelationCollection as $productRelation) {
49
+ $idsToPurge[] = $productRelation->getParentId();
50
  }
51
  // purge categories of parent products
52
  if ($purgeCategories) {
53
  $categoryProductCollection = $this->_getCategoryProductRelationCollection()
54
  ->filterAllByProductIds($productRelationCollection->getAllIds());
55
+
56
  foreach ($categoryProductCollection as $categoryProduct) {
57
+ $categoryIdsToPurge[] = $categoryProduct->getCategoryId();
58
  }
59
  }
60
  }
61
+
62
+ $this->_purgeByIds($idsToPurge);
63
+
64
  if ($purgeCategories) {
 
65
  foreach ($product->getCategoryCollection() as $category) {
66
+ $categoryIdsToPurge[] = $category->getId();
67
  }
68
  $this->_getSession()->addSuccess(
69
  Mage::helper('varnishcache')->__('Varnish cache for the product\'s categories has been purged.')
70
  );
71
  }
72
+
73
+ $this->_purgeCategoriesByIds($categoryIdsToPurge);
74
  }
75
  return $this;
76
  }
99
  {
100
  $collection = $this->_getUrlRewriteCollection()
101
  ->filterAllByProductId($id);
102
+ $urlPaths = array();
103
+ foreach ($collection as $urlRewriteRule) {
104
+ $urlPaths[] = $urlRewriteRule->getRequestPath();
105
+ }
106
+ $urlRegexp = '/(' . implode('|', $urlPaths) . ')';
107
+ $this->_getCacheControl()
108
+ ->clean($this->_getStoreDomainList(), $urlRegexp);
109
+ return $this;
110
+ }
111
+
112
+ /**
113
+ * Purge product by ids
114
+ *
115
+ * @param $ids
116
+ *
117
+ * @return Phoenix_VarnishCache_Model_Control_Catalog_Product
118
+ */
119
+ protected function _purgeCategoriesByIds($ids)
120
+ {
121
+ $idPaths = array();
122
+ foreach ($ids as $id) {
123
+ $idPaths[] = "category/$id";
124
+ }
125
+
126
+ $collection = $this->_getUrlRewriteCollection();
127
+ $collection->getSelect()
128
+ ->where('id_path IN ("' . implode('","', $idPaths) . '")');
129
+
130
+ $urlPaths = array();
131
  foreach ($collection as $urlRewriteRule) {
132
+ $urlPaths[] = $urlRewriteRule->getRequestPath();
 
 
133
  }
134
+
135
+ $this->_getCacheControl()->cleanUrlPaths($this->_getStoreDomainList(), $urlPaths);
136
+ }
137
+
138
+ /**
139
+ * Purge product by ids
140
+ *
141
+ * @param $ids
142
+ *
143
+ * @return Phoenix_VarnishCache_Model_Control_Catalog_Product
144
+ */
145
+ protected function _purgeByIds($ids)
146
+ {
147
+ $idPaths = array();
148
+ foreach ($ids as $id) {
149
+ $idPaths[] = "product/$id";
150
+ }
151
+
152
+ $collection = $this->_getUrlRewriteCollection();
153
+ $collection->getSelect()
154
+ ->where('id_path IN ("' . implode('","', $idPaths) . '")');
155
+
156
+ foreach ($idPaths as $idPath) {
157
+ $collection->getSelect()
158
+ ->orWhere('id_path LIKE "' . $idPath . '/%"');
159
+ }
160
+
161
+ $urlPaths = array();
162
+ foreach ($collection as $urlRewriteRule) {
163
+ $urlPaths[] = $urlRewriteRule->getRequestPath();
164
+ }
165
+
166
+ $this->_getCacheControl()->cleanUrlPaths($this->_getStoreDomainList(), $urlPaths);
167
+
168
  return $this;
169
  }
170
 
app/code/community/Phoenix/VarnishCache/Model/Control/Cms/Page.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Model/Observer.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
@@ -305,7 +305,7 @@ class Phoenix_VarnishCache_Model_Observer
305
  }
306
  return $this;
307
  }
308
-
309
  /**
310
  * Shows notice to update Varnish VCL file
311
  *
@@ -317,11 +317,11 @@ class Phoenix_VarnishCache_Model_Observer
317
  try {
318
  Mage::getSingleton('core/session')->addNotice(
319
  Mage::helper('varnishcache')->__(
320
- 'Update Varnish VCL with design exceptions by using the following snippet:'
321
  )
322
  );
323
 
324
- $designExceptionSubSnippet = Mage::getSingleton('varnishcacheenterprise/vcl')
325
  ->generateDesignExceptionSub();
326
 
327
  $designExceptionSubSnippet = str_replace(' ', '&nbsp;', $designExceptionSubSnippet);
@@ -375,4 +375,36 @@ class Phoenix_VarnishCache_Model_Observer
375
  }
376
  }
377
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
378
  }
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
305
  }
306
  return $this;
307
  }
308
+
309
  /**
310
  * Shows notice to update Varnish VCL file
311
  *
317
  try {
318
  Mage::getSingleton('core/session')->addNotice(
319
  Mage::helper('varnishcache')->__(
320
+ 'Update Varnish VCL with design exceptions by using the following snippet:'
321
  )
322
  );
323
 
324
+ $designExceptionSubSnippet = Mage::getSingleton('varnishcache/vcl')
325
  ->generateDesignExceptionSub();
326
 
327
  $designExceptionSubSnippet = str_replace(' ', '&nbsp;', $designExceptionSubSnippet);
375
  }
376
  }
377
  }
378
+
379
+ /**
380
+ * replace all occurrences of the form key
381
+ *
382
+ * @param Varien_Event_Observer $observer
383
+ */
384
+ public function replaceFormKeys(Varien_Event_Observer $observer)
385
+ {
386
+ $esiHelper = Mage::helper('varnishcache/esi');
387
+ if (!$esiHelper->hasFormKey()) {
388
+ return false;
389
+ }
390
+
391
+ $response = $observer->getResponse();
392
+ $html = $response->getBody();
393
+ $html = $esiHelper->replaceFormKey($html);
394
+
395
+ $response->setBody($html);
396
+ }
397
+
398
+ /**
399
+ * Register form key in session from cookie value
400
+ *
401
+ * @param Varien_Event_Observer $observer
402
+ */
403
+ public function registerCookieFormKey(Varien_Event_Observer $observer)
404
+ {
405
+ if ($formKey = Mage::helper('varnishcache/esi')->getCookieFormKey()) {
406
+ $session = Mage::getSingleton('core/session');
407
+ $session->setData('_form_key', $formKey);
408
+ }
409
+ }
410
  }
app/code/community/Phoenix/VarnishCache/Model/Processor.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Catalog/Category/Product.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Catalog/Category/Product/Collection.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Catalog/Product/Relation/Collection.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Cms/Page/Store.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Cms/Page/Store/Collection.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Core/Url/Rewrite/Collection.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/controllers/Adminhtml/VarnishCacheController.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/code/community/Phoenix/VarnishCache/etc/config.xml CHANGED
@@ -15,14 +15,14 @@
15
  *
16
  * @category Phoenix
17
  * @package Phoenix_VarnishCache
18
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
  -->
22
  <config>
23
  <modules>
24
  <Phoenix_VarnishCache>
25
- <version>4.0.5</version>
26
  </Phoenix_VarnishCache>
27
  </modules>
28
  <global>
@@ -203,6 +203,7 @@
203
  </observers>
204
  </cms_page_save_after>
205
 
 
206
  <core_config_backend_design_exception_save_commit_after>
207
  <observers>
208
  <varnishcache>
@@ -285,6 +286,22 @@
285
  </varnishcache>
286
  </observers>
287
  </wishlist_add_product>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
  </events>
289
  </frontend>
290
  <default>
15
  *
16
  * @category Phoenix
17
  * @package Phoenix_VarnishCache
18
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
  -->
22
  <config>
23
  <modules>
24
  <Phoenix_VarnishCache>
25
+ <version>4.2.0</version>
26
  </Phoenix_VarnishCache>
27
  </modules>
28
  <global>
203
  </observers>
204
  </cms_page_save_after>
205
 
206
+ <!-- show vcl update message -->
207
  <core_config_backend_design_exception_save_commit_after>
208
  <observers>
209
  <varnishcache>
286
  </varnishcache>
287
  </observers>
288
  </wishlist_add_product>
289
+ <http_response_send_before>
290
+ <observers>
291
+ <varnishcache>
292
+ <class>varnishcache/observer</class>
293
+ <method>replaceFormKeys</method>
294
+ </varnishcache>
295
+ </observers>
296
+ </http_response_send_before>
297
+ <controller_action_predispatch>
298
+ <observers>
299
+ <varnishcache>
300
+ <class>varnishcache/observer</class>
301
+ <method>registerCookieFormKey</method>
302
+ </varnishcache>
303
+ </observers>
304
+ </controller_action_predispatch>
305
  </events>
306
  </frontend>
307
  <default>
app/code/community/Phoenix/VarnishCache/etc/default_3.0.vcl CHANGED
@@ -1,5 +1,8 @@
1
  # This is a basic VCL configuration file for PageCache powered by Varnish for Magento module.
2
 
 
 
 
3
  # default backend definition. Set this to point to your content server.
4
  backend default {
5
  .host = "127.0.0.1";
@@ -22,11 +25,20 @@ acl purge {
22
 
23
  import std;
24
 
 
 
 
 
 
 
 
 
 
 
25
  sub vcl_recv {
26
  if (req.restarts == 0) {
27
  if (req.http.x-forwarded-for) {
28
- set req.http.X-Forwarded-For =
29
- req.http.X-Forwarded-For + ", " + client.ip;
30
  } else {
31
  set req.http.X-Forwarded-For = client.ip;
32
  }
@@ -75,6 +87,30 @@ sub vcl_recv {
75
  unset req.http.Cookie;
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  # not cacheable by default
79
  if (req.http.Authorization || req.http.Https) {
80
  return (pass);
@@ -91,9 +127,9 @@ sub vcl_recv {
91
  }
92
 
93
  # remove Google gclid parameters
94
- set req.url = regsuball(req.url,"\?gclid=[^&]+$",""); # strips when QS = "?gclid=AAA"
95
- set req.url = regsuball(req.url,"\?gclid=[^&]+&","?"); # strips when QS = "?gclid=AAA&foo=bar"
96
- set req.url = regsuball(req.url,"&gclid=[^&]+",""); # strips when QS = "?foo=bar&gclid=AAA" or QS = "?foo=bar&gclid=AAA&bar=baz"
97
 
98
  return (lookup);
99
  }
@@ -107,11 +143,11 @@ sub vcl_recv {
107
  # # applications, like IIS with NTLM authentication.
108
  # return (pipe);
109
  # }
110
- #
111
  # sub vcl_pass {
112
  # return (pass);
113
  # }
114
- #
115
  sub vcl_hash {
116
  hash_data(req.url);
117
  if (req.http.host) {
@@ -135,17 +171,20 @@ sub vcl_hash {
135
  }
136
  return (hash);
137
  }
138
- #
139
  # sub vcl_hit {
140
  # return (deliver);
141
  # }
142
- #
143
  # sub vcl_miss {
144
  # return (fetch);
145
  # }
146
 
147
  sub vcl_fetch {
148
- if (beresp.status == 500) {
 
 
 
149
  set beresp.saintmode = 10s;
150
  return (restart);
151
  }
@@ -157,7 +196,7 @@ sub vcl_fetch {
157
  }
158
 
159
  # add ban-lurker tags to object
160
- set beresp.http.X-Purge-URL = req.url;
161
  set beresp.http.X-Purge-Host = req.http.host;
162
 
163
  if (beresp.status == 200 || beresp.status == 301 || beresp.status == 404) {
@@ -186,12 +225,12 @@ sub vcl_deliver {
186
  # debug info
187
  if (resp.http.X-Cache-Debug) {
188
  if (obj.hits > 0) {
189
- set resp.http.X-Cache = "HIT";
190
  set resp.http.X-Cache-Hits = obj.hits;
191
  } else {
192
- set resp.http.X-Cache = "MISS";
193
  }
194
- set resp.http.X-Cache-Expires = resp.http.Expires;
195
  } else {
196
  # remove Varnish/proxy header
197
  remove resp.http.X-Varnish;
@@ -206,43 +245,89 @@ sub vcl_deliver {
206
  unset resp.http.magicmarker;
207
 
208
  set resp.http.Cache-Control = "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
209
- set resp.http.Pragma = "no-cache";
210
- set resp.http.Expires = "Mon, 31 Mar 2008 10:00:00 GMT";
211
- set resp.http.Age = "0";
212
  }
213
  }
214
 
215
- # sub vcl_error {
216
- # set obj.http.Content-Type = "text/html; charset=utf-8";
217
- # set obj.http.Retry-After = "5";
218
- # synthetic {"
219
- # <?xml version="1.0" encoding="utf-8"?>
220
- # <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
221
- # "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
222
- # <html>
223
- # <head>
224
- # <title>"} + obj.status + " " + obj.response + {"</title>
225
- # </head>
226
- # <body>
227
- # <h1>Error "} + obj.status + " " + obj.response + {"</h1>
228
- # <p>"} + obj.response + {"</p>
229
- # <h3>Guru Meditation:</h3>
230
- # <p>XID: "} + req.xid + {"</p>
231
- # <hr>
232
- # <p>Varnish cache server</p>
233
- # </body>
234
- # </html>
235
- # "};
236
- # return (deliver);
237
- # }
238
- #
239
- # sub vcl_init {
240
- # return (ok);
241
- # }
242
- #
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  # sub vcl_fini {
244
  # return (ok);
245
  # }
246
 
247
  sub design_exception {
248
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # This is a basic VCL configuration file for PageCache powered by Varnish for Magento module.
2
 
3
+ # include variable handling methods
4
+ include "vars.vcl";
5
+
6
  # default backend definition. Set this to point to your content server.
7
  backend default {
8
  .host = "127.0.0.1";
25
 
26
  import std;
27
 
28
+ sub vcl_init {
29
+ C{
30
+ /* set random salt */
31
+ srand(time(NULL));
32
+
33
+ /* init var storage */
34
+ init_function(NULL, NULL);
35
+ }C
36
+ }
37
+
38
  sub vcl_recv {
39
  if (req.restarts == 0) {
40
  if (req.http.x-forwarded-for) {
41
+ set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;
 
42
  } else {
43
  set req.http.X-Forwarded-For = client.ip;
44
  }
87
  unset req.http.Cookie;
88
  }
89
 
90
+ # check if we have a formkey cookie
91
+ if (req.http.Cookie ~ "PAGECACHE_FORMKEY") {
92
+ set req.http.x-var-input = regsub(req.http.cookie, ".*PAGECACHE_FORMKEY=([^;]*)(;*.*)?", "\1");
93
+ call var_set;
94
+ } else {
95
+ # create formkey once
96
+ if (req.esi_level == 0) {
97
+ C{
98
+ generate_formkey(sp, 16);
99
+ }C
100
+ set req.http.x-var-input = req.http.X-Pagecache-Formkey;
101
+ call var_set;
102
+ }
103
+ }
104
+ # cleanup variables
105
+ unset req.http.x-var-input;
106
+ unset req.http.X-Pagecache-Formkey;
107
+
108
+ # formkey lookup
109
+ if (req.url ~ "/varnishcache/getformkey/") {
110
+ call var_get;
111
+ error 760 req.http.x-var-output;
112
+ }
113
+
114
  # not cacheable by default
115
  if (req.http.Authorization || req.http.Https) {
116
  return (pass);
127
  }
128
 
129
  # remove Google gclid parameters
130
+ set req.url = regsuball(req.url, "\?gclid=[^&]+$", ""); # strips when QS = "?gclid=AAA"
131
+ set req.url = regsuball(req.url, "\?gclid=[^&]+&", "?"); # strips when QS = "?gclid=AAA&foo=bar"
132
+ set req.url = regsuball(req.url, "&gclid=[^&]+", ""); # strips when QS = "?foo=bar&gclid=AAA" or QS = "?foo=bar&gclid=AAA&bar=baz"
133
 
134
  return (lookup);
135
  }
143
  # # applications, like IIS with NTLM authentication.
144
  # return (pipe);
145
  # }
146
+
147
  # sub vcl_pass {
148
  # return (pass);
149
  # }
150
+
151
  sub vcl_hash {
152
  hash_data(req.url);
153
  if (req.http.host) {
171
  }
172
  return (hash);
173
  }
174
+
175
  # sub vcl_hit {
176
  # return (deliver);
177
  # }
178
+
179
  # sub vcl_miss {
180
  # return (fetch);
181
  # }
182
 
183
  sub vcl_fetch {
184
+ if (beresp.status >= 500) {
185
+ if (beresp.http.Content-Type ~ "text/xml") {
186
+ return (deliver);
187
+ }
188
  set beresp.saintmode = 10s;
189
  return (restart);
190
  }
196
  }
197
 
198
  # add ban-lurker tags to object
199
+ set beresp.http.X-Purge-URL = req.url;
200
  set beresp.http.X-Purge-Host = req.http.host;
201
 
202
  if (beresp.status == 200 || beresp.status == 301 || beresp.status == 404) {
225
  # debug info
226
  if (resp.http.X-Cache-Debug) {
227
  if (obj.hits > 0) {
228
+ set resp.http.X-Cache = "HIT";
229
  set resp.http.X-Cache-Hits = obj.hits;
230
  } else {
231
+ set resp.http.X-Cache = "MISS";
232
  }
233
+ set resp.http.X-Cache-Expires = resp.http.Expires;
234
  } else {
235
  # remove Varnish/proxy header
236
  remove resp.http.X-Varnish;
245
  unset resp.http.magicmarker;
246
 
247
  set resp.http.Cache-Control = "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
248
+ set resp.http.Pragma = "no-cache";
249
+ set resp.http.Expires = "Mon, 31 Mar 2008 10:00:00 GMT";
250
+ set resp.http.Age = "0";
251
  }
252
  }
253
 
254
+ sub vcl_error {
255
+ # workaround for possible security issue
256
+ if (req.url ~ "^\s") {
257
+ set obj.status = 400;
258
+ set obj.response = "Malformed request";
259
+ synthetic "";
260
+ return(deliver);
261
+ }
262
+
263
+ # formkey request
264
+ if (obj.status == 760) {
265
+ set obj.status = 200;
266
+ synthetic obj.response;
267
+ return(deliver);
268
+ }
269
+
270
+ # error 200
271
+ if (obj.status == 200) {
272
+ return (deliver);
273
+ }
274
+
275
+ set obj.http.Content-Type = "text/html; charset=utf-8";
276
+ set obj.http.Retry-After = "5";
277
+ synthetic {"
278
+ <?xml version="1.0" encoding="utf-8"?>
279
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
280
+ <html>
281
+ <head>
282
+ <title>"} + obj.status + " " + obj.response + {"</title>
283
+ </head>
284
+ <body>
285
+ <h1>Error "} + obj.status + " " + obj.response + {"</h1>
286
+ <p>"} + obj.response + {"</p>
287
+ <h3>Guru Meditation:</h3>
288
+ <p>XID: "} + req.xid + {"</p>
289
+ <hr>
290
+ <p>Varnish cache server</p>
291
+ </body>
292
+ </html>
293
+ "};
294
+ return (deliver);
295
+ }
296
+
297
+
298
  # sub vcl_fini {
299
  # return (ok);
300
  # }
301
 
302
  sub design_exception {
303
  }
304
+
305
+ C{
306
+ #include <string.h>
307
+ #include <stdio.h>
308
+ #include <stdlib.h>
309
+ #include <time.h>
310
+
311
+ /**
312
+ * create a random alphanumeric string and store it in
313
+ * the request header as X-Pagecache-Formkey
314
+ */
315
+ char *generate_formkey(struct sess *sp, int maxLength) {
316
+ char *validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
317
+ int validCharsLength = strlen(validChars);
318
+ char *result = (char *) malloc(maxLength + 1);
319
+
320
+ // generate string
321
+ int i;
322
+ for (i = 0; i < maxLength; ++i) {
323
+ int charPosition = rand() % validCharsLength;
324
+ result[i] = validChars[charPosition];
325
+ }
326
+ result[maxLength] = '\0';
327
+
328
+ // set req.X-Country-Code header
329
+ VRT_SetHdr(sp, HDR_REQ, "\024X-Pagecache-Formkey:", result, vrt_magic_string_end);
330
+
331
+ return 0;
332
+ }
333
+ }C
app/code/community/Phoenix/VarnishCache/etc/system.xml CHANGED
@@ -15,7 +15,7 @@
15
  *
16
  * @category Phoenix
17
  * @package Phoenix_VarnishCache
18
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
  -->
15
  *
16
  * @category Phoenix
17
  * @package Phoenix_VarnishCache
18
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
  -->
app/code/community/Phoenix/VarnishCache/etc/vars.vcl ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ C{
2
+ #include <errno.h>
3
+ #include <netinet/in.h>
4
+ #include <pthread.h>
5
+ #include <stdlib.h>
6
+ #include <string.h>
7
+
8
+ typedef void vas_f(const char *, const char *, int, const char *, int, int);
9
+ extern vas_f *VAS_Fail;
10
+
11
+ #define assert(e) \
12
+ do { \
13
+ if (!(e)) \
14
+ VAS_Fail(__func__, __FILE__, __LINE__, #e, errno, 0); \
15
+ } while (0)
16
+
17
+ #define AZ(foo) do { assert((foo) == 0); } while (0)
18
+ #define AN(foo) do { assert((foo) != 0); } while (0)
19
+
20
+ #define CHECK_OBJ_NOTNULL(ptr, type_magic) \
21
+ do { \
22
+ assert((ptr) != NULL); \
23
+ assert((ptr)->magic == type_magic); \
24
+ } while (0)
25
+
26
+ #define ALLOC_OBJ(to, type_magic) \
27
+ do { \
28
+ (to) = calloc(sizeof *(to), 1); \
29
+ if ((to) != NULL) \
30
+ (to)->magic = (type_magic); \
31
+ } while (0)
32
+
33
+ struct sess {
34
+ unsigned magic;
35
+ #define SESS_MAGIC 0x2c2f9c5a
36
+ int fd;
37
+ int id;
38
+ unsigned xid;
39
+
40
+ /* For the sake of inlining this, pretend struct sess ends
41
+ here ... */
42
+ };
43
+
44
+ struct var {
45
+ unsigned magic;
46
+ #define VAR_MAGIC 0xbbd57783
47
+ unsigned xid;
48
+ char *value;
49
+ };
50
+
51
+ static struct var **var_list = NULL;
52
+ static int var_list_sz = 0;
53
+ static pthread_mutex_t var_list_mtx = PTHREAD_MUTEX_INITIALIZER;
54
+
55
+ static void
56
+ var_clean(struct var *v)
57
+ {
58
+ CHECK_OBJ_NOTNULL(v, VAR_MAGIC);
59
+ free(v->value);
60
+ v->value = NULL;
61
+ }
62
+
63
+ int
64
+ init_function(struct vmod_priv *priv, const struct VCL_conf *conf)
65
+ {
66
+ AZ(pthread_mutex_lock(&var_list_mtx));
67
+ if (var_list == NULL) {
68
+ AZ(var_list_sz);
69
+ var_list_sz = 256;
70
+ var_list = malloc(sizeof(struct var *) * 256);
71
+ AN(var_list);
72
+ int i;
73
+ for (i = 0 ; i < var_list_sz; i++) {
74
+ ALLOC_OBJ(var_list[i], VAR_MAGIC);
75
+ var_list[i]->xid = 0;
76
+ var_list[i]->value = NULL;
77
+ }
78
+ }
79
+ AZ(pthread_mutex_unlock(&var_list_mtx));
80
+ return (0);
81
+ }
82
+
83
+
84
+ static struct var *
85
+ get_var(struct sess *sp)
86
+ {
87
+ struct var *v;
88
+
89
+ AZ(pthread_mutex_lock(&var_list_mtx));
90
+ while (var_list_sz <= sp->id) {
91
+ int ns = var_list_sz*2;
92
+ /* resize array */
93
+ var_list = realloc(var_list, ns * sizeof(struct var_entry *));
94
+ for (; var_list_sz < ns; var_list_sz++) {
95
+ ALLOC_OBJ(var_list[var_list_sz], VAR_MAGIC);
96
+ var_list[var_list_sz]->xid = 0;
97
+ var_list[var_list_sz]->value = NULL;
98
+ }
99
+ assert(var_list_sz == ns);
100
+ AN(var_list);
101
+ }
102
+ v = var_list[sp->id];
103
+
104
+ if (v->xid != sp->xid) {
105
+ var_clean(v);
106
+ v->xid = sp->xid;
107
+ }
108
+ AZ(pthread_mutex_unlock(&var_list_mtx));
109
+ return (v);
110
+ }
111
+
112
+ void
113
+ vmod_set(struct sess *sp, const char *value)
114
+ {
115
+ struct var *v = get_var(sp);
116
+ CHECK_OBJ_NOTNULL(v, VAR_MAGIC);
117
+ var_clean(v);
118
+ if (value == NULL)
119
+ value = "";
120
+ v->value = strdup(value);
121
+ }
122
+
123
+ const char *
124
+ vmod_get(struct sess *sp)
125
+ {
126
+ struct var *v = get_var(sp);
127
+ CHECK_OBJ_NOTNULL(v, VAR_MAGIC);
128
+ return (v->value);
129
+ }
130
+ }C
131
+
132
+ sub vcl_init {
133
+ C{
134
+ init_function(NULL, NULL);
135
+ }C
136
+ }
137
+
138
+ # input: req.http.x-var-input
139
+ sub var_set {
140
+ C{
141
+ vmod_set(sp, VRT_GetHdr(sp, HDR_REQ, "\014X-var-input:"));
142
+ }C
143
+ }
144
+
145
+ # output: req.http.x-var-output
146
+ sub var_get {
147
+ C{
148
+ VRT_SetHdr(sp, HDR_REQ, "\015X-var-output:", vmod_get(sp), vrt_magic_string_end);
149
+ }C
150
+ }
app/code/community/Phoenix/VarnishCache/sql/varnishcache_setup/install-4.0.0.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
app/design/adminhtml/default/default/layout/varnishcache.xml CHANGED
@@ -15,7 +15,7 @@
15
  *
16
  * @category Phoenix
17
  * @package Phoenix_VarnishCache
18
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
  -->
15
  *
16
  * @category Phoenix
17
  * @package Phoenix_VarnishCache
18
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
  -->
app/design/adminhtml/default/default/template/varnishcache/cache/additional.phtml CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
  ?>
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
  ?>
app/design/frontend/base/default/layout/varnishcache.xml CHANGED
@@ -15,7 +15,7 @@
15
  *
16
  * @category Phoenix
17
  * @package Phoenix_VarnishCache
18
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
  -->
@@ -23,7 +23,8 @@
23
  <layout>
24
  <default>
25
  <reference name="before_body_end">
26
- <block type="varnishcache/cookie_environment" name="varnish.cache.cookie_environment" template="varnishcache/cookie/environment.phtml" />
 
27
  </reference>
28
  </default>
29
  </layout>
15
  *
16
  * @category Phoenix
17
  * @package Phoenix_VarnishCache
18
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
  -->
23
  <layout>
24
  <default>
25
  <reference name="before_body_end">
26
+ <block type="varnishcache/cookie_environment" name="varnishcache.cookie_environment" template="varnishcache/cookie/environment.phtml" />
27
+ <block type="varnishcache/cookie_formkey" name="varnishcache.cookie_formkey" template="varnishcache/cookie/formkey.phtml" />
28
  </reference>
29
  </default>
30
  </layout>
app/design/frontend/base/default/template/varnishcache/cookie/environment.phtml CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
  ?>
14
  *
15
  * @category Phoenix
16
  * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
  ?>
app/design/frontend/base/default/template/varnishcache/cookie/formkey.phtml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PageCache powered by Varnish
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to support@phoenix-media.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Phoenix
16
+ * @package Phoenix_VarnishCache
17
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+ ?>
21
+ <?php
22
+ /**
23
+ * Set formkey cookie template
24
+ *
25
+ * @see Phoenix_VarnishCache_Block_Cookie_Formkey
26
+ */
27
+ ?>
28
+ <?php
29
+ $_cookieName = $this->getCookieName();
30
+ $_formKeyValue = $this->getFormKeyValue();
31
+ ?>
32
+ <script type="text/javascript">
33
+ if (document.cookie.length && (document.cookie.indexOf('<?php echo $_cookieName; ?>=') == -1)) {
34
+ Mage.Cookies.set(
35
+ '<?php echo $_cookieName; ?>',
36
+ '<?php echo $_formKeyValue; ?>',
37
+ new Date(new Date().getTime() + <?php echo $this->getCookieLifetime(); ?>)
38
+ );
39
+ }
40
+ </script>
app/etc/modules/Phoenix_VarnishCache.xml CHANGED
@@ -15,7 +15,7 @@
15
  *
16
  * @category Phoenix
17
  * @package Phoenix_VarnishCache
18
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
  -->
15
  *
16
  * @category Phoenix
17
  * @package Phoenix_VarnishCache
18
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
  -->
app/etc/varnishcache.xml CHANGED
@@ -15,7 +15,7 @@
15
  *
16
  * @category Phoenix
17
  * @package Phoenix_VarnishCache
18
- * @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
  -->
15
  *
16
  * @category Phoenix
17
  * @package Phoenix_VarnishCache
18
+ * @copyright Copyright (c) 2011-2014 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
  -->
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Varnish_Cache</name>
4
- <version>4.0.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -14,12 +14,11 @@
14
  &lt;p&gt;&#xA0;&lt;/p&gt;
15
  &lt;p&gt;&lt;strong&gt;Features:&lt;/strong&gt;&lt;/p&gt;
16
  &lt;p&gt;- Allows &lt;strong&gt;full page caching&lt;/strong&gt; of Magento store frontends with &lt;a href="http://www.varnish-cache.org" target="_blank"&gt;Varnish&lt;/a&gt;&lt;br /&gt;- Prevent caching of pages containing custom information (shopping carts, logins)&lt;br /&gt;- Configure request paths (controller, action) to be excluded from caching&lt;br /&gt;- Clean caches for single store views or content types&lt;br /&gt;- Maintain several Varnish instances&#xA0;from the Magento backend&lt;br /&gt;- Set TTL for content pages per store view&lt;br /&gt;- Deactivate Varnish cache for single store views or websites&lt;br /&gt;- Easily deactivate caching for certain Magento modules&lt;br /&gt;- Enable debug mode to analyse any issues&lt;br /&gt;&lt;strong&gt;- Ready to go Varnish configuration file (VCL)&lt;/strong&gt;&lt;/p&gt;</description>
17
- <notes>- fixed issue with caching of store switching requests
18
- - fixed compatibility issue with older magento versions</notes>
19
  <authors><author><name>PHOENIX MEDIA</name><user>auto-converted</user><email>info@phoenix-media.eu</email></author></authors>
20
- <date>2013-07-05</date>
21
- <time>15:13:12</time>
22
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="varnishcache.xml" hash="2454a4ad3e9bede38bb1b2ccff46fd95"/></dir><dir name="template"><dir name="varnishcache"><dir name="cache"><file name="additional.phtml" hash="486f1e32ff3f020200d91bcb81c20cad"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="varnishcache.xml" hash="ebb2baa59f12763907785379f5f47c47"/></dir><dir name="template"><dir name="varnishcache"><dir name="cookie"><file name="environment.phtml" hash="762076bac2e7d1c45c5bb56f541b1475"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Phoenix_VarnishCache.csv" hash="fcd310b9d66d55abe92df78272edefb6"/></dir><dir name="en_US"><file name="Phoenix_VarnishCache.csv" hash="8fcaa3e009cf8ccec3e92b374a78a736"/></dir><dir name="es_ES"><file name="Phoenix_VarnishCache.csv" hash="eeaf2afe930687a4e5cdca5ffa02eb5b"/></dir><dir name="fr_FR"><file name="Phoenix_VarnishCache.csv" hash="f1926328dbd4bae4c23e585b7afb8309"/></dir><dir name="nb_NO"><file name="Phoenix_VarnishCache.csv" hash="077ab381e4eb8a50e638743a8fcf4fe6"/></dir></target><target name="mageetc"><dir name="modules"><file name="Phoenix_VarnishCache.xml" hash="09b2744bddf997a78cfb624ce6be20aa"/></dir><dir name="."><file name="varnishcache.xml" hash="8fdb975ad8c93e472486f3867a056b18"/></dir></target><target name="magecommunity"><dir name="Phoenix"><dir name="VarnishCache"><dir name="Block"><dir name="Adminhtml"><dir name="Cache"><file name="Additional.php" hash="44a8dc640984917ae31e5a2d450e8fba"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="RouteTTL.php" hash="de6271e60800ac70c9089c74b434a059"/><file name="Versioninfo.php" hash="add2ed546fad4a0f5617ea97165e73c0"/></dir></dir></dir></dir><dir name="Cookie"><file name="Environment.php" hash="24a57c76e6a69360faa3ade070df27a2"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="VarnishCacheController.php" hash="32381c357ce32712c5efed8daf230c50"/></dir></dir><dir name="etc"><file name="config.xml" hash="5817860430d7bc0c59f67eae4490cbf8"/><file name="default_3.0.vcl" hash="73c9b78464ea4bd64510d1d990f6d198"/><file name="system.xml" hash="78061a0fa7bee61a2e07f9253c79d6d6"/></dir><dir name="Helper"><dir name="Control"><dir name="Catalog"><file name="Category.php" hash="e58a8770c92b0ea2e2ff5bd892d334c2"/><file name="Product.php" hash="9de4d4b30c42fba3d9f9c08be3a538e2"/></dir><dir name="Cms"><file name="Page.php" hash="2cffdefd0c885c7e7c5e194b3e961c93"/></dir></dir><file name="Cache.php" hash="c21b40120225c4109c4c3c63f6dd9f0e"/><file name="Data.php" hash="949ba1821c33dea347b4dcc922b55a80"/></dir><dir name="Model"><dir name="Catalog"><dir name="Category"><file name="Product.php" hash="76fc154142e1c3aa59048107decf623e"/></dir><dir name="Product"><file name="Relation.php" hash="ad3a5929041ee76f3580aedf2b971356"/></dir></dir><dir name="Cms"><dir name="Page"><file name="Store.php" hash="1c7ab8d36e106d5e05d8042eaba7edc9"/></dir></dir><dir name="Control"><dir name="Catalog"><file name="Category.php" hash="b8a0d4e2256dae6c058cb830fe10e868"/><file name="Product.php" hash="18bb7d8df378051dab6b049bf9efedfe"/></dir><dir name="Cms"><file name="Page.php" hash="ad8480b584c64242b6311a3e35c23e5d"/></dir><file name="Abstract.php" hash="8d09e21ac95b81ac7a6575b23bd73a29"/></dir><dir name="Resource"><dir name="Mysql4"><dir name="Catalog"><dir name="Category"><dir name="Product"><file name="Collection.php" hash="75d70fef15bfde606fde7c1bbc7841d3"/></dir><file name="Product.php" hash="f429e2db437f16a679de9dbd9da28b30"/></dir><dir name="Product"><dir name="Relation"><file name="Collection.php" hash="c08fdc136ef5e2c4ef10361cf98067a5"/></dir></dir></dir><dir name="Cms"><dir name="Page"><dir name="Store"><file name="Collection.php" hash="a63387a48e2f96fbfb9b4b7a157b85d1"/></dir><file name="Store.php" hash="bb7f0738ded20199b1994ede2499fe8b"/></dir></dir><dir name="Core"><dir name="Url"><dir name="Rewrite"><file name="Collection.php" hash="e808bb4ff25ace9a4e6b3c4fa11c2888"/></dir></dir></dir></dir></dir><file name="Control.php" hash="10dc0c4d6153902c0bf42c826ae41187"/><file name="Observer.php" hash="e73759880ccbc80ccb15d64957c49084"/><file name="Processor.php" hash="d246663026bc67d74a262ab5f9a50cc3"/></dir><dir name="sql"><dir name="varnishcache_setup"><file name="install-4.0.0.php" hash="c39a62488663a0dc26f85542b9188a9d"/></dir></dir></dir></dir></target><target name="mage"><dir name="."><file name="README_VARNISH_CACHE.txt" hash="046ffff8efb2f1626fbfaeb16b146c61"/></dir></target></contents>
23
  <compatible/>
24
  <dependencies/>
25
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Varnish_Cache</name>
4
+ <version>4.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
14
  &lt;p&gt;&#xA0;&lt;/p&gt;
15
  &lt;p&gt;&lt;strong&gt;Features:&lt;/strong&gt;&lt;/p&gt;
16
  &lt;p&gt;- Allows &lt;strong&gt;full page caching&lt;/strong&gt; of Magento store frontends with &lt;a href="http://www.varnish-cache.org" target="_blank"&gt;Varnish&lt;/a&gt;&lt;br /&gt;- Prevent caching of pages containing custom information (shopping carts, logins)&lt;br /&gt;- Configure request paths (controller, action) to be excluded from caching&lt;br /&gt;- Clean caches for single store views or content types&lt;br /&gt;- Maintain several Varnish instances&#xA0;from the Magento backend&lt;br /&gt;- Set TTL for content pages per store view&lt;br /&gt;- Deactivate Varnish cache for single store views or websites&lt;br /&gt;- Easily deactivate caching for certain Magento modules&lt;br /&gt;- Enable debug mode to analyse any issues&lt;br /&gt;&lt;strong&gt;- Ready to go Varnish configuration file (VCL)&lt;/strong&gt;&lt;/p&gt;</description>
17
+ <notes>- fixed issue with form key in Magento CE &gt; 1.8</notes>
 
18
  <authors><author><name>PHOENIX MEDIA</name><user>auto-converted</user><email>info@phoenix-media.eu</email></author></authors>
19
+ <date>2014-10-09</date>
20
+ <time>17:48:31</time>
21
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="varnishcache.xml" hash="c2bf6a7de0a2a12d6d7a66a403b3c639"/></dir><dir name="template"><dir name="varnishcache"><dir name="cache"><file name="additional.phtml" hash="ddf6396dc4fe260bb725d4d173d1e9f2"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="varnishcache.xml" hash="cf08914886988446e81770c5d71c8417"/></dir><dir name="template"><dir name="varnishcache"><dir name="cookie"><file name="environment.phtml" hash="cafdc575223b59575c7cace37e3e596f"/><file name="formkey.phtml" hash="172e0374d8cb62d1e3a494a170a57e34"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Phoenix_VarnishCache.csv" hash="fcd310b9d66d55abe92df78272edefb6"/></dir><dir name="en_US"><file name="Phoenix_VarnishCache.csv" hash="8fcaa3e009cf8ccec3e92b374a78a736"/></dir><dir name="es_ES"><file name="Phoenix_VarnishCache.csv" hash="eeaf2afe930687a4e5cdca5ffa02eb5b"/></dir><dir name="fr_FR"><file name="Phoenix_VarnishCache.csv" hash="f1926328dbd4bae4c23e585b7afb8309"/></dir><dir name="nb_NO"><file name="Phoenix_VarnishCache.csv" hash="077ab381e4eb8a50e638743a8fcf4fe6"/></dir></target><target name="mageetc"><dir name="modules"><file name="Phoenix_VarnishCache.xml" hash="a35642665f4c9ebded9a00ba60e392ce"/></dir><dir name="."><file name="varnishcache.xml" hash="dd2b62cc78ea6a435d78f5d4fa6cbf53"/></dir></target><target name="magecommunity"><dir name="Phoenix"><dir name="VarnishCache"><dir name="Block"><dir name="Adminhtml"><dir name="Cache"><file name="Additional.php" hash="e9d28a5617caa6d986736d42c0ae81dc"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="RouteTTL.php" hash="e8dabcea12ea7057726dd4e5508dbff0"/><file name="Versioninfo.php" hash="3282077fe7dca1ed95857d866ce63fa0"/></dir></dir></dir></dir><dir name="Cookie"><file name="Environment.php" hash="4aad8a94fdf574744af13014051b9db2"/><file name="Formkey.php" hash="29f22774f6d44740266fa593922e633d"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="VarnishCacheController.php" hash="8e2a6d16f440e99fc11bf49e8135e893"/></dir></dir><dir name="etc"><file name="config.xml" hash="9e835e7607807ddb965c150321537b49"/><file name="default_3.0.vcl" hash="a6f61f0ee1281c1ec0dfb6b61b96b3eb"/><file name="system.xml" hash="fa845ec5f1d823b8ac5aafb832116e54"/><file name="vars.vcl" hash="37594a5577997fa1bbb2441223bbc6aa"/></dir><dir name="Helper"><dir name="Control"><dir name="Catalog"><file name="Category.php" hash="49d62df775eea6bfe9e33e0e9d2da062"/><file name="Product.php" hash="9eee32f522283dbea1b2a72e7831bcc9"/></dir><dir name="Cms"><file name="Page.php" hash="8f39bcb51d6d7aae90fdd528035606c2"/></dir></dir><file name="Cache.php" hash="f73b798aa402685467b97c97641ea32e"/><file name="Data.php" hash="1fb321ba8bf2623e327a4417a239c1f6"/><file name="Esi.php" hash="f24202f87bcac7644c020919cf3a7ec4"/></dir><dir name="Model"><dir name="Catalog"><dir name="Category"><file name="Product.php" hash="68459ecc0a36861b4cb86e7ba099730b"/></dir><dir name="Product"><file name="Relation.php" hash="4e80a4104e2350f9ce0e0f2548b6ed87"/></dir></dir><dir name="Cms"><dir name="Page"><file name="Store.php" hash="6c8b66dc03eca83676a2032c7003f2f6"/></dir></dir><dir name="Control"><dir name="Catalog"><file name="Category.php" hash="bf1bb95a8c8fcec7b163a0115e16efc1"/><file name="Product.php" hash="bb812000e58b758ed1256cc53dc85e46"/></dir><dir name="Cms"><file name="Page.php" hash="384e2b5f24ac679eddf2fc0a24c8dc5d"/></dir><file name="Abstract.php" hash="a9446d010232337b306f8b1f3d53769f"/></dir><dir name="Resource"><dir name="Mysql4"><dir name="Catalog"><dir name="Category"><dir name="Product"><file name="Collection.php" hash="4145efc91724bef4529fbeadea41023f"/></dir><file name="Product.php" hash="74a15f49018c53fe34df540bdffd8fe6"/></dir><dir name="Product"><dir name="Relation"><file name="Collection.php" hash="423c3463306c369af1ad3f99a6b1f597"/></dir></dir></dir><dir name="Cms"><dir name="Page"><dir name="Store"><file name="Collection.php" hash="829efa7bf0101058bc97710b50a75dce"/></dir><file name="Store.php" hash="e74ddaf82b761d6bbde75fdba21c1301"/></dir></dir><dir name="Core"><dir name="Url"><dir name="Rewrite"><file name="Collection.php" hash="3a72e23edf9baa04880acbe01a6e794c"/></dir></dir></dir></dir></dir><file name="Control.php" hash="c19117df2154154c105a117e0d5b4955"/><file name="Observer.php" hash="b4c0a5415e3328ba414cd3772efc7cdd"/><file name="Processor.php" hash="6a74c8974d1386b8dce0edc3bd4ecdcb"/></dir><dir name="sql"><dir name="varnishcache_setup"><file name="install-4.0.0.php" hash="db69351281e7f74941ad71bfe7e97c14"/></dir></dir></dir></dir></target><target name="mage"><dir name="."><file name="README_VARNISH_CACHE.txt" hash="6f2eba62c3931792595cbf078a7855b3"/></dir></target></contents>
22
  <compatible/>
23
  <dependencies/>
24
  </package>