Nexcessnet_Turpentine - Version 0.5.3

Version Notes

Supports Magento v1.6 and later

Download this release

Release Info

Developer Chris Wells
Extension Nexcessnet_Turpentine
Version 0.5.3
Comparing to
See all releases


Code changes from version 0.5.2 to 0.5.3

app/code/community/Nexcessnet/Turpentine/Block/Catalog/Product/List/Toolbar.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Nexcess.net Turpentine Extension for Magento
5
+ * Copyright (C) 2012 Nexcess.net L.L.C.
6
+ *
7
+ * This program is free software; you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation; either version 2 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License along
18
+ * with this program; if not, write to the Free Software Foundation, Inc.,
19
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
+ */
21
+
22
+ class Nexcessnet_Turpentine_Block_Catalog_Product_List_Toolbar extends
23
+ Mage_Catalog_Block_Product_List_Toolbar {
24
+
25
+ public function _construct() {
26
+ parent::_construct();
27
+ $this->disableParamsMemorizing();
28
+ }
29
+ }
app/code/community/Nexcessnet/Turpentine/Block/Core/Messages.php CHANGED
@@ -331,9 +331,7 @@ class Nexcessnet_Turpentine_Block_Core_Messages extends Mage_Core_Block_Messages
331
  * @return bool
332
  */
333
  protected function _fixMessages() {
334
- return Mage::helper( 'turpentine/data' )
335
- ->useFlashMessagesFix() &&
336
- Mage::app()->getStore()->getCode() !== 'admin';
337
  }
338
 
339
  /**
331
  * @return bool
332
  */
333
  protected function _fixMessages() {
334
+ return Mage::helper( 'turpentine/esi' )->shouldFixFlashMessages();
 
 
335
  }
336
 
337
  /**
app/code/community/Nexcessnet/Turpentine/Helper/Data.php CHANGED
@@ -242,6 +242,27 @@ class Nexcessnet_Turpentine_Helper_Data extends Mage_Core_Helper_Abstract {
242
  'turpentine_varnish/general/ajax_messages' );
243
  }
244
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  /**
246
  * The actual recursive implementation of getChildBlockNames
247
  *
242
  'turpentine_varnish/general/ajax_messages' );
243
  }
244
 
245
+ /**
246
+ * Check config to see if Turpentine should apply the product list toolbar
247
+ * fix
248
+ *
249
+ * @return bool
250
+ */
251
+ public function useProductListToolbarFix() {
252
+ return (bool)Mage::getStoreConfig(
253
+ 'turpentine_varnish/general/fix_product_toolbar' );
254
+ }
255
+
256
+ /**
257
+ * Check if Turpentine should apply the new VCL on config changes
258
+ *
259
+ * @return bool
260
+ */
261
+ public function getAutoApplyOnSave() {
262
+ return (bool)Mage::getStoreConfig(
263
+ 'turpentine_varnish/general/auto_apply_on_save' );
264
+ }
265
+
266
  /**
267
  * The actual recursive implementation of getChildBlockNames
268
  *
app/code/community/Nexcessnet/Turpentine/Helper/Debug.php CHANGED
@@ -54,7 +54,8 @@ class Nexcessnet_Turpentine_Helper_Debug extends Mage_Core_Helper_Abstract {
54
  break;
55
  }
56
  }
57
- return parent::__call( $name, $args );
 
58
  }
59
 
60
  /**
54
  break;
55
  }
56
  }
57
+ // return parent::__call( $name, $args );
58
+ return null;
59
  }
60
 
61
  /**
app/code/community/Nexcessnet/Turpentine/Helper/Esi.php CHANGED
@@ -139,6 +139,16 @@ class Nexcessnet_Turpentine_Helper_Esi extends Mage_Core_Helper_Abstract {
139
  'turpentine_varnish/general/block_debug' );
140
  }
141
 
 
 
 
 
 
 
 
 
 
 
142
  /**
143
  * Get URL for redirects and dummy requests
144
  *
139
  'turpentine_varnish/general/block_debug' );
140
  }
141
 
142
+ /**
143
+ * Check if the flash messages are enabled and we're not in the admin section
144
+ *
145
+ * @return bool
146
+ */
147
+ public function shouldFixFlashMessages() {
148
+ return Mage::helper( 'turpentine/data' )->useFlashMessagesFix() &&
149
+ Mage::app()->getStore()->getCode() !== 'admin';
150
+ }
151
+
152
  /**
153
  * Get URL for redirects and dummy requests
154
  *
app/code/community/Nexcessnet/Turpentine/Helper/Varnish.php CHANGED
@@ -144,4 +144,15 @@ class Nexcessnet_Turpentine_Helper_Varnish extends Mage_Core_Helper_Abstract {
144
  public function getDefaultTtl() {
145
  return Mage::getStoreConfig( 'turpentine_vcl/ttls/default_ttl' );
146
  }
 
 
 
 
 
 
 
 
 
 
 
147
  }
144
  public function getDefaultTtl() {
145
  return Mage::getStoreConfig( 'turpentine_vcl/ttls/default_ttl' );
146
  }
147
+
148
+ /**
149
+ * Check if the product list toolbar fix is enabled and we're not in the
150
+ * admin section
151
+ *
152
+ * @return bool
153
+ */
154
+ public function shouldFixProductListToolbar() {
155
+ return Mage::helper( 'turpentine/data' )->useProductListToolbarFix() &&
156
+ Mage::app()->getStore()->getCode() !== 'admin';
157
+ }
158
  }
app/code/community/Nexcessnet/Turpentine/Model/Observer/Esi.php CHANGED
@@ -104,24 +104,6 @@ class Nexcessnet_Turpentine_Model_Observer_Esi extends Varien_Event_Observer {
104
  }
105
  }
106
 
107
- protected function _fixupUencUrl( $uencUrl ) {
108
- $esiHelper = Mage::helper( 'turpentine/esi' );
109
- $corsOrigin = $esiHelper->getCorsOrigin();
110
- if( $corsOrigin != $esiHelper->getCorsOrigin( $uencUrl ) ) {
111
- return $corsOrigin . parse_url( $uencUrl, PHP_URL_PATH );
112
- } else {
113
- return $uencUrl;
114
- }
115
- }
116
-
117
- protected function _checkIsNotEsiUrl( $url ) {
118
- return $url && !preg_match( '~/turpentine/esi/getBlock/~', $url );
119
- }
120
-
121
- protected function _checkIsEsiUrl( $url ) {
122
- return !$this->_checkIsNotEsiUrl( $url );
123
- }
124
-
125
  /**
126
  * Load the cache clear events from stored config
127
  *
@@ -140,6 +122,26 @@ class Nexcessnet_Turpentine_Model_Observer_Esi extends Varien_Event_Observer {
140
  Varien_Profiler::stop( 'turpentine::observer::esi::loadCacheClearEvents' );
141
  }
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  /**
144
  * Encode block data in URL then replace with ESI template
145
  *
@@ -402,4 +404,41 @@ class Nexcessnet_Turpentine_Model_Observer_Esi extends Varien_Event_Observer {
402
  );
403
  return $data;
404
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
  }
104
  }
105
  }
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  /**
108
  * Load the cache clear events from stored config
109
  *
122
  Varien_Profiler::stop( 'turpentine::observer::esi::loadCacheClearEvents' );
123
  }
124
 
125
+ /**
126
+ * Add the core/messages block rewrite if the flash message fix is enabled
127
+ *
128
+ * The core/messages block is rewritten because it doesn't use a template
129
+ * we can replace with an ESI include tag, just dumps out a block of
130
+ * hard-coded HTML and also frequently skips the toHtml method
131
+ *
132
+ * @param Varien_Object $eventObject
133
+ * @return null
134
+ */
135
+ public function addMessagesBlockRewrite( $eventObject ) {
136
+ if( Mage::helper( 'turpentine/esi' )->shouldFixFlashMessages() ) {
137
+ Varien_Profiler::start( 'turpentine::observer::esi::addMessagesBlockRewrite' );
138
+ Mage::getSingleton( 'turpentine/shim_mage_core_app' )
139
+ ->shim_addClassRewrite( 'block', 'core', 'messages',
140
+ 'Nexcessnet_Turpentine_Block_Core_Messages' );
141
+ Varien_Profiler::stop( 'turpentine::observer::esi::addMessagesBlockRewrite' );
142
+ }
143
+ }
144
+
145
  /**
146
  * Encode block data in URL then replace with ESI template
147
  *
404
  );
405
  return $data;
406
  }
407
+
408
+ /**
409
+ * Fix a URL to ensure it uses Magento's base URL instead of the backend
410
+ * URL
411
+ *
412
+ * @param string $uencUrl
413
+ * @return string
414
+ */
415
+ protected function _fixupUencUrl( $uencUrl ) {
416
+ $esiHelper = Mage::helper( 'turpentine/esi' );
417
+ $corsOrigin = $esiHelper->getCorsOrigin();
418
+ if( $corsOrigin != $esiHelper->getCorsOrigin( $uencUrl ) ) {
419
+ return $corsOrigin . parse_url( $uencUrl, PHP_URL_PATH );
420
+ } else {
421
+ return $uencUrl;
422
+ }
423
+ }
424
+
425
+ /**
426
+ * Check if a URL *is not* for the /turpentine/esi/getBlock/ action
427
+ *
428
+ * @param string $url
429
+ * @return bool
430
+ */
431
+ protected function _checkIsNotEsiUrl( $url ) {
432
+ return $url && !preg_match( '~/turpentine/esi/getBlock/~', $url );
433
+ }
434
+
435
+ /**
436
+ * Check if a URL *is* for the /turpentine/esi/getBlock/ action
437
+ *
438
+ * @param string $url
439
+ * @return bool
440
+ */
441
+ protected function _checkIsEsiUrl( $url ) {
442
+ return !$this->_checkIsNotEsiUrl( $url );
443
+ }
444
  }
app/code/community/Nexcessnet/Turpentine/Model/Observer/Varnish.php CHANGED
@@ -41,6 +41,20 @@ class Nexcessnet_Turpentine_Model_Observer_Varnish extends Varien_Event_Observer
41
  }
42
  }
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  /**
45
  * Re-apply and save Varnish configuration on config change
46
  *
@@ -48,7 +62,8 @@ class Nexcessnet_Turpentine_Model_Observer_Varnish extends Varien_Event_Observer
48
  * @return null
49
  */
50
  public function adminSystemConfigChangedSection( $eventObject ) {
51
- if( Mage::helper( 'turpentine/varnish' )->getVarnishEnabled() ) {
 
52
  $result = Mage::getModel( 'turpentine/varnish_admin' )->applyConfig();
53
  $session = Mage::getSingleton( 'core/session' );
54
  foreach( $result as $name => $value ) {
41
  }
42
  }
43
 
44
+ /**
45
+ * Add a rewrite for catalog/product_list_toolbar if config option enabled
46
+ *
47
+ * @param Varien_Object $eventObject
48
+ * @return null
49
+ */
50
+ public function addProductListToolbarRewrite( $eventObject ) {
51
+ if( Mage::helper( 'turpentine/varnish' )->shouldFixProductListToolbar() ) {
52
+ Mage::getSingleton( 'turpentine/shim_mage_core_app' )
53
+ ->shim_addClassRewrite( 'block', 'catalog', 'product_list_toolbar',
54
+ 'Nexcessnet_Turpentine_Block_Catalog_Product_List_Toolbar' );
55
+ }
56
+ }
57
+
58
  /**
59
  * Re-apply and save Varnish configuration on config change
60
  *
62
  * @return null
63
  */
64
  public function adminSystemConfigChangedSection( $eventObject ) {
65
+ if( Mage::helper( 'turpentine/varnish' )->getVarnishEnabled() &&
66
+ Mage::helper( 'turpentine/data' )->getAutoApplyOnSave() ) {
67
  $result = Mage::getModel( 'turpentine/varnish_admin' )->applyConfig();
68
  $session = Mage::getSingleton( 'core/session' );
69
  foreach( $result as $name => $value ) {
app/code/community/Nexcessnet/Turpentine/Model/Shim/Mage/Core/App.php CHANGED
@@ -31,7 +31,7 @@ class Nexcessnet_Turpentine_Model_Shim_Mage_Core_App extends Mage_Core_Model_App
31
  * This is needed because there is no setRequest in CE < 1.7 and EE < 1.12
32
  *
33
  * @param Mage_Core_Controller_Request_Http $request
34
- * @return Mage_Core_Model_App
35
  */
36
  public function shim_setRequest(Mage_Core_Controller_Request_Http $request) {
37
  $app = $this->_shim_getApp();
@@ -53,19 +53,39 @@ class Nexcessnet_Turpentine_Model_Shim_Mage_Core_App extends Mage_Core_Model_App
53
  * @param string $type (model|singleton)
54
  * @param string $class identifier of the observing model class
55
  * @param string $method name of the method to call
56
- * @return Mage_Core_Model_App
57
  */
58
  public function shim_addEventObserver( $area, $eventName, $obsName,
59
  $type=null, $class=null, $method=null ) {
60
  $eventConfig = new Varien_Simplexml_Config();
61
- $eventConfig->loadDom( $this->_shim_getConfigDom(
62
  $area, $eventName, $obsName, $type, $class, $method ) );
63
- Mage::getConfig()->extend( $eventConfig, true );
64
  // this wouldn't work if PHP had a sane object model
65
  $this->_shim_getApp()->_events[$area][$eventName] = null;
66
  return $this;
67
  }
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  /**
70
  * Prepares event DOM node used for updating configuration
71
  *
@@ -77,14 +97,15 @@ class Nexcessnet_Turpentine_Model_Shim_Mage_Core_App extends Mage_Core_Model_App
77
  * @param string $method
78
  * @return DOMDocument
79
  */
80
- protected function _shim_getConfigDom( $area, $eventName, $obsName,
81
  $type=null, $class=null, $method=null ) {
82
  $dom = new DOMDocument( '1.0' );
83
  $config = $dom->createElement( 'config' );
84
- $observers = $config->appendChild( $dom->createElement( $area ) )
85
- ->appendChild( $dom->createElement( 'events' ) )
86
- ->appendChild( $dom->createElement( $eventName ) )
87
- ->appendChild( $dom->createElement( 'observers' ) );
 
88
  $observer = $dom->createElement( $obsName );
89
  if( $class && $method ) {
90
  if( $type ) {
@@ -98,6 +119,26 @@ class Nexcessnet_Turpentine_Model_Shim_Mage_Core_App extends Mage_Core_Model_App
98
  return $dom;
99
  }
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  /**
102
  * Get the real app
103
  *
@@ -106,4 +147,22 @@ class Nexcessnet_Turpentine_Model_Shim_Mage_Core_App extends Mage_Core_Model_App
106
  protected function _shim_getApp() {
107
  return Mage::app();
108
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  }
31
  * This is needed because there is no setRequest in CE < 1.7 and EE < 1.12
32
  *
33
  * @param Mage_Core_Controller_Request_Http $request
34
+ * @return Nexcessnet_Turpentine_Model_Shim_Mage_Core_App
35
  */
36
  public function shim_setRequest(Mage_Core_Controller_Request_Http $request) {
37
  $app = $this->_shim_getApp();
53
  * @param string $type (model|singleton)
54
  * @param string $class identifier of the observing model class
55
  * @param string $method name of the method to call
56
+ * @return Nexcessnet_Turpentine_Model_Shim_Mage_Core_App
57
  */
58
  public function shim_addEventObserver( $area, $eventName, $obsName,
59
  $type=null, $class=null, $method=null ) {
60
  $eventConfig = new Varien_Simplexml_Config();
61
+ $eventConfig->loadDom( $this->_shim_getEventDom(
62
  $area, $eventName, $obsName, $type, $class, $method ) );
63
+ $this->_shim_getConfig()->extend( $eventConfig, true );
64
  // this wouldn't work if PHP had a sane object model
65
  $this->_shim_getApp()->_events[$area][$eventName] = null;
66
  return $this;
67
  }
68
 
69
+ /**
70
+ * Add a new block/model/helper rewrite
71
+ *
72
+ * @param string $type rewrite type (helper|model|block)
73
+ * @param string $module module part of class spec, "example" in "example/model"
74
+ * @param string $class class part of class spec, "model" in "example/model"
75
+ * @param string $rewriteTarget full class name to rewrite to
76
+ * @return Nexcessnet_Turpentine_Model_Shim_Mage_Core_App
77
+ */
78
+ public function shim_addClassRewrite( $type, $module, $class,
79
+ $rewriteTarget ) {
80
+ $rewriteConfig = new Varien_Simplexml_Config();
81
+ $rewriteConfig->loadDom( $this->_shim_getRewriteDom(
82
+ $type, $module, $class, $rewriteTarget ) );
83
+ $this->_shim_getConfig()->extend( $rewriteConfig, true );
84
+ $this->_shim_getConfigShim()->shim_setClassNameCache(
85
+ $type, $module, $class, $rewriteTarget );
86
+ return $this;
87
+ }
88
+
89
  /**
90
  * Prepares event DOM node used for updating configuration
91
  *
97
  * @param string $method
98
  * @return DOMDocument
99
  */
100
+ protected function _shim_getEventDom( $area, $eventName, $obsName,
101
  $type=null, $class=null, $method=null ) {
102
  $dom = new DOMDocument( '1.0' );
103
  $config = $dom->createElement( 'config' );
104
+ $observers = $config
105
+ ->appendChild( $dom->createElement( $area ) )
106
+ ->appendChild( $dom->createElement( 'events' ) )
107
+ ->appendChild( $dom->createElement( $eventName ) )
108
+ ->appendChild( $dom->createElement( 'observers' ) );
109
  $observer = $dom->createElement( $obsName );
110
  if( $class && $method ) {
111
  if( $type ) {
119
  return $dom;
120
  }
121
 
122
+ /**
123
+ * Generate the dom to add a new block/model/helper rewrite to the config
124
+ *
125
+ * @param string $groupType rewrite type (helper|model|block)
126
+ * @param string $group module part of class spec, "example" in "example/model"
127
+ * @param string $class classname part of class spec, "model" in "example/model"
128
+ * @param string $className full class name to rewrite to
129
+ * @return DOMDocument
130
+ */
131
+ protected function _shim_getRewriteDom( $groupType, $group, $class, $className ) {
132
+ $dom = new DOMDocument( '1.0' );
133
+ $dom->appendChild( $dom->createElement( 'config' ) )
134
+ ->appendChild( $dom->createElement( 'global' ) )
135
+ ->appendChild( $dom->createElement( $groupType . 's' ) )
136
+ ->appendChild( $dom->createElement( $group ) )
137
+ ->appendChild( $dom->createElement( 'rewrite' ) )
138
+ ->appendChild( $dom->createElement( $class, $className ) );
139
+ return $dom;
140
+ }
141
+
142
  /**
143
  * Get the real app
144
  *
147
  protected function _shim_getApp() {
148
  return Mage::app();
149
  }
150
+
151
+ /**
152
+ * Get the config from the real app
153
+ *
154
+ * @return Mage_Core_Model_Config
155
+ */
156
+ protected function _shim_getConfig() {
157
+ return $this->_shim_getApp()->getConfig();
158
+ }
159
+
160
+ /**
161
+ * Get the config shim
162
+ *
163
+ * @return Nexcessnet_Turpentine_Model_Shim_Mage_Core_Config
164
+ */
165
+ protected function _shim_getConfigShim() {
166
+ return Mage::getModel( 'turpentine/shim_mage_core_config' );
167
+ }
168
  }
app/code/community/Nexcessnet/Turpentine/Model/Shim/Mage/Core/Config.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Nexcess.net Turpentine Extension for Magento
5
+ * Copyright (C) 2012 Nexcess.net L.L.C.
6
+ *
7
+ * This program is free software; you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation; either version 2 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License along
18
+ * with this program; if not, write to the Free Software Foundation, Inc.,
19
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
+ */
21
+
22
+ class Nexcessnet_Turpentine_Model_Shim_Mage_Core_Config extends Mage_Core_Model_Config {
23
+
24
+ /**
25
+ * Apply a block/helper/model rewrite to the config's rewrite cache. Returns
26
+ * the previous value from the cache
27
+ *
28
+ * @param string $groupType rewrite type (helper|model|block)
29
+ * @param string $group module part of class spec, "example" in "example/model"
30
+ * @param string $class classname part of class spec, "model" in "example/model"
31
+ * @param string $className full class name to rewrite to
32
+ * @return string
33
+ */
34
+ public function shim_setClassNameCache( $groupType, $group, $class, $className ) {
35
+ $config = Mage::getConfig();
36
+ $prevValue = @$config->_classNameCache[$groupType][$group][$class];
37
+ $config->_classNameCache[$groupType][$group][$class] = $className;
38
+ return $prevValue;
39
+ }
40
+ }
app/code/community/Nexcessnet/Turpentine/Model/Varnish/Admin/Socket.php CHANGED
@@ -45,7 +45,7 @@
45
  */
46
  class Nexcessnet_Turpentine_Model_Varnish_Admin_Socket {
47
 
48
- //possible command return codes, from vcli.h
49
  const CODE_SYNTAX = 100;
50
  const CODE_UNKNOWN = 101;
51
  const CODE_UNIMPL = 102;
@@ -59,8 +59,9 @@ class Nexcessnet_Turpentine_Model_Varnish_Admin_Socket {
59
  const CODE_CLOSE = 500;
60
 
61
  const READ_CHUNK_SIZE = 1024;
62
- //varnish default, can be changed at Varnish startup time but it's probably not
63
- //worth the trouble to dynamically detect at runtime
 
64
  const CLI_CMD_LENGTH_LIMIT = 8192;
65
 
66
  /**
@@ -343,15 +344,26 @@ class Nexcessnet_Turpentine_Model_Varnish_Admin_Socket {
343
  $this->_connect();
344
  }
345
  $data = rtrim( $data ) . PHP_EOL;
346
- if( strlen( $data ) >= self::CLI_CMD_LENGTH_LIMIT ) {
347
- Mage::throwException( sprintf(
348
- 'Varnish data to write over length limit by %d characters',
349
- strlen( $data ) - self::CLI_CMD_LENGTH_LIMIT ) );
 
 
 
 
 
 
 
 
 
 
 
 
350
  }
351
- $byteCount = fwrite( $this->_varnishConn, $data );
352
- if( $byteCount !== strlen( $data ) ) {
353
  Mage::throwException( sprintf( 'Varnish socket write error: %d != %d',
354
- $byteCount, strlen( $data ) ) );
355
  }
356
  return $this;
357
  }
45
  */
46
  class Nexcessnet_Turpentine_Model_Varnish_Admin_Socket {
47
 
48
+ // possible command return codes, from vcli.h
49
  const CODE_SYNTAX = 100;
50
  const CODE_UNKNOWN = 101;
51
  const CODE_UNIMPL = 102;
59
  const CODE_CLOSE = 500;
60
 
61
  const READ_CHUNK_SIZE = 1024;
62
+ // varnish default, can only be changed at Varnish startup time
63
+ // if data to write is over this limit the actual run-time limit is checked
64
+ // and used
65
  const CLI_CMD_LENGTH_LIMIT = 8192;
66
 
67
  /**
344
  $this->_connect();
345
  }
346
  $data = rtrim( $data ) . PHP_EOL;
347
+ $dataLength = strlen( $data );
348
+ if( $dataLength >= self::CLI_CMD_LENGTH_LIMIT ) {
349
+ $cliBufferResponse = $this->param_show( 'cli_buffer' );
350
+ if( preg_match( '~^cli_buffer\s+(\d+)\s+\[bytes\]~',
351
+ $cliBufferResponse['text'], $match ) ) {
352
+ $realLimit = (int)$match[1];
353
+ } else {
354
+ Mage::helper( 'turpentine/debug' )->logWarn(
355
+ 'Failed to determine Varnish cli_buffer limit, using default' );
356
+ $realLimit = self::CLI_CMD_LENGTH_LIMIT;
357
+ }
358
+ if( $dataLength >= $realLimit ) {
359
+ Mage::throwException( sprintf(
360
+ 'Varnish data to write over length limit by %d characters',
361
+ $dataLength - $realLimit ) );
362
+ }
363
  }
364
+ if( ( $byteCount = fwrite( $this->_varnishConn, $data ) ) !== $dataLength ) {
 
365
  Mage::throwException( sprintf( 'Varnish socket write error: %d != %d',
366
+ $byteCount, $dataLength ) );
367
  }
368
  return $this;
369
  }
app/code/community/Nexcessnet/Turpentine/controllers/EsiController.php CHANGED
@@ -86,6 +86,10 @@ class Nexcessnet_Turpentine_EsiController extends Mage_Core_Controller_Front_Act
86
  $resp->setHeader( 'X-Turpentine-Flush-Events',
87
  implode( ',', $flushEvents ) );
88
  }
 
 
 
 
89
  } else {
90
  $resp->setHttpResponseCode( 404 );
91
  $resp->setBody( 'ESI block not found' );
86
  $resp->setHeader( 'X-Turpentine-Flush-Events',
87
  implode( ',', $flushEvents ) );
88
  }
89
+ if( $esiHelper->getEsiDebugEnabled() ) {
90
+ $resp->setHeader( 'X-Turpentine-Block',
91
+ $block->getNameInLayout() );
92
+ }
93
  } else {
94
  $resp->setHttpResponseCode( 404 );
95
  $resp->setBody( 'ESI block not found' );
app/code/community/Nexcessnet/Turpentine/etc/config.xml CHANGED
@@ -20,15 +20,17 @@
20
  <config>
21
  <modules>
22
  <Nexcessnet_Turpentine>
23
- <version>0.5.2</version>
24
  </Nexcessnet_Turpentine>
25
  </modules>
26
  <default>
27
  <turpentine_varnish>
28
  <general>
 
29
  <varnish_debug>0</varnish_debug>
30
  <block_debug>0</block_debug>
31
  <ajax_messages>1</ajax_messages>
 
32
  <crawler_enable>0</crawler_enable>
33
  <crawler_debug>0</crawler_debug>
34
  </general>
@@ -94,16 +96,24 @@
94
  <turpentine>
95
  <class>Nexcessnet_Turpentine_Block</class>
96
  </turpentine>
 
 
 
 
 
 
 
 
 
 
 
 
97
  <core>
98
  <rewrite>
99
- <!--
100
- Rewritten because it doesn't use a template we can replace
101
- with an ESI include tag, just dumps out a block of
102
- hard-coded HTML and also frequently skips the toHtml method
103
- -->
104
  <messages>Nexcessnet_Turpentine_Block_Core_Messages</messages>
105
  </rewrite>
106
  </core>
 
107
  </blocks>
108
  <helpers>
109
  <turpentine>
@@ -218,6 +228,14 @@
218
  <class>turpentine/observer_esi</class>
219
  <method>loadCacheClearEvents</method>
220
  </turpentine_esi_controller_front_init_before>
 
 
 
 
 
 
 
 
221
  </observers>
222
  </controller_front_init_before>
223
 
@@ -254,6 +272,10 @@
254
  </turpentine_varnish_catalog_category_save_commit_after>
255
  </observers>
256
  </catalog_category_save_commit_after>
 
 
 
 
257
  <clean_media_cache_after>
258
  <observers>
259
  <turpentine_varnish_clean_media_cache_after>
@@ -270,6 +292,7 @@
270
  </turpentine_varnish_clean_catalog_images_cache_after>
271
  </observers>
272
  </clean_catalog_images_cache_after>
 
273
  <cms_page_save_commit_after>
274
  <observers>
275
  <turpentine_varnish_cms_page_save_commit_after>
20
  <config>
21
  <modules>
22
  <Nexcessnet_Turpentine>
23
+ <version>0.5.3</version>
24
  </Nexcessnet_Turpentine>
25
  </modules>
26
  <default>
27
  <turpentine_varnish>
28
  <general>
29
+ <auto_apply_on_save>1</auto_apply_on_save>
30
  <varnish_debug>0</varnish_debug>
31
  <block_debug>0</block_debug>
32
  <ajax_messages>1</ajax_messages>
33
+ <fix_product_toolbar>0</fix_product_toolbar>
34
  <crawler_enable>0</crawler_enable>
35
  <crawler_debug>0</crawler_debug>
36
  </general>
96
  <turpentine>
97
  <class>Nexcessnet_Turpentine_Block</class>
98
  </turpentine>
99
+ <!--
100
+ The core/messages block is rewritten because it doesn't use a
101
+ template we can replace with an ESI include tag, just dumps out a
102
+ block of hard-coded HTML and also frequently skips the toHtml method
103
+
104
+ However, since class rewrites aren't conditional and we only want to
105
+ do this rewrite if the Enable Flash Messages option is enabled the
106
+ rewrite is actually added at runtime (controller_front_init_before),
107
+ see observer_esi::addMessagesBlockRewrite . Leaving this rewrite
108
+ here but commented out for clarity
109
+ -->
110
+ <!--
111
  <core>
112
  <rewrite>
 
 
 
 
 
113
  <messages>Nexcessnet_Turpentine_Block_Core_Messages</messages>
114
  </rewrite>
115
  </core>
116
+ -->
117
  </blocks>
118
  <helpers>
119
  <turpentine>
228
  <class>turpentine/observer_esi</class>
229
  <method>loadCacheClearEvents</method>
230
  </turpentine_esi_controller_front_init_before>
231
+ <turpentine_esi_controller_front_init_before2>
232
+ <class>turpentine/observer_esi</class>
233
+ <method>addMessagesBlockRewrite</method>
234
+ </turpentine_esi_controller_front_init_before2>
235
+ <turpentine_varnish_controller_front_init_before>
236
+ <class>turpentine/observer_varnish</class>
237
+ <method>addProductListToolbarRewrite</method>
238
+ </turpentine_varnish_controller_front_init_before>
239
  </observers>
240
  </controller_front_init_before>
241
 
272
  </turpentine_varnish_catalog_category_save_commit_after>
273
  </observers>
274
  </catalog_category_save_commit_after>
275
+ <!--
276
+ This is disabled because it causes broken images on cached pages
277
+ -->
278
+ <!--
279
  <clean_media_cache_after>
280
  <observers>
281
  <turpentine_varnish_clean_media_cache_after>
292
  </turpentine_varnish_clean_catalog_images_cache_after>
293
  </observers>
294
  </clean_catalog_images_cache_after>
295
+ -->
296
  <cms_page_save_commit_after>
297
  <observers>
298
  <turpentine_varnish_cms_page_save_commit_after>
app/code/community/Nexcessnet/Turpentine/etc/system.xml CHANGED
@@ -42,6 +42,16 @@
42
  <show_in_website>0</show_in_website>
43
  <show_in_store>0</show_in_store>
44
  <fields>
 
 
 
 
 
 
 
 
 
 
45
  <varnish_debug translate="label" module="turpentine">
46
  <label>Enable Debug Info</label>
47
  <comment>It is a major security vulnerability, to leave this enabled on production sites</comment>
@@ -72,6 +82,16 @@
72
  <show_in_website>0</show_in_website>
73
  <show_in_store>0</show_in_store>
74
  </ajax_messages>
 
 
 
 
 
 
 
 
 
 
75
  <crawler_enable translate="label" module="turpentine">
76
  <label>Enable Site Crawler</label>
77
  <comment>Enable to allow Turpentine to automatically warm the cache</comment>
42
  <show_in_website>0</show_in_website>
43
  <show_in_store>0</show_in_store>
44
  <fields>
45
+ <auto_apply_on_save translate="label" module="turpentine">
46
+ <label>Apply VCL On Config Change</label>
47
+ <comment>Automatically generate and apply the new VCL when a change is made to the Varnish or Caching options</comment>
48
+ <frontend_type>select</frontend_type>
49
+ <source_model>turpentine/config_select_toggle</source_model>
50
+ <sort_order>20</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>0</show_in_website>
53
+ <show_in_store>0</show_in_store>
54
+ </auto_apply_on_save>
55
  <varnish_debug translate="label" module="turpentine">
56
  <label>Enable Debug Info</label>
57
  <comment>It is a major security vulnerability, to leave this enabled on production sites</comment>
82
  <show_in_website>0</show_in_website>
83
  <show_in_store>0</show_in_store>
84
  </ajax_messages>
85
+ <fix_product_toolbar translate="label" module="turpentine">
86
+ <label>Fix Product List Toolbar</label>
87
+ <comment>Enable this to prevent caching the products-per-page setting in the product list</comment>
88
+ <frontend_type>select</frontend_type>
89
+ <source_model>turpentine/config_select_toggle</source_model>
90
+ <sort_order>65</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>0</show_in_website>
93
+ <show_in_store>0</show_in_store>
94
+ </fix_product_toolbar>
95
  <crawler_enable translate="label" module="turpentine">
96
  <label>Enable Site Crawler</label>
97
  <comment>Enable to allow Turpentine to automatically warm the cache</comment>
app/code/community/Nexcessnet/Turpentine/misc/version-2.vcl CHANGED
@@ -143,6 +143,14 @@ sub vcl_recv {
143
  set req.backend = admin;
144
  return (pipe);
145
  }
 
 
 
 
 
 
 
 
146
  # looks like an ESI request, add some extra vars for further processing
147
  if (req.url ~ "/turpentine/esi/getBlock/") {
148
  set req.http.X-Varnish-Esi-Method = regsub(
@@ -185,6 +193,12 @@ sub vcl_recv {
185
  if (req.url ~ "{{url_base_regex}}(?:{{url_excludes}})") {
186
  return (pipe);
187
  }
 
 
 
 
 
 
188
  if (req.http.X-Opt-Enable-Get-Excludes == "true" &&
189
  req.url ~ "(?:[?&](?:{{get_param_excludes}})(?=[&=]|$))") {
190
  return (pass);
@@ -221,6 +235,9 @@ sub vcl_hash {
221
  # make sure we give back the right encoding
222
  set req.hash += req.http.Accept-Encoding;
223
  }
 
 
 
224
  if (req.http.X-Varnish-Esi-Access == "private" &&
225
  req.http.Cookie ~ "frontend=") {
226
  set req.hash += regsub(req.http.Cookie, "^.*?frontend=([^;]*);*.*$", "\1");
@@ -332,6 +349,8 @@ sub vcl_deliver {
332
  set resp.http.X-Varnish-Hits = obj.hits;
333
  set resp.http.X-Varnish-Esi-Method = req.http.X-Varnish-Esi-Method;
334
  set resp.http.X-Varnish-Esi-Access = req.http.X-Varnish-Esi-Access;
 
 
335
  } else {
336
  # remove Varnish fingerprints
337
  remove resp.http.X-Varnish;
@@ -341,6 +360,7 @@ sub vcl_deliver {
341
  remove resp.http.X-Turpentine-Cache;
342
  remove resp.http.X-Turpentine-Esi;
343
  remove resp.http.X-Turpentine-Flush-Events;
 
344
  remove resp.http.X-Varnish-Session;
345
  # this header indicates the session that originally generated a cached
346
  # page. it *must* not be sent to a client in production with lax
143
  set req.backend = admin;
144
  return (pipe);
145
  }
146
+ if (req.http.Cookie ~ "\bcurrency=") {
147
+ set req.http.X-Varnish-Currency = regsub(
148
+ req.http.Cookie, ".*\bcurrency=([^;]*).*", "\1");
149
+ }
150
+ if (req.http.Cookie ~ "\bstore=") {
151
+ set req.http.X-Varnish-Store = regsub(
152
+ req.http.Cookie, ".*\bstore=([^;]*).*", "\1");
153
+ }
154
  # looks like an ESI request, add some extra vars for further processing
155
  if (req.url ~ "/turpentine/esi/getBlock/") {
156
  set req.http.X-Varnish-Esi-Method = regsub(
193
  if (req.url ~ "{{url_base_regex}}(?:{{url_excludes}})") {
194
  return (pipe);
195
  }
196
+ if (req.url ~ "\?.*__from_store=") {
197
+ # user switched stores. we pipe this instead of passing below because
198
+ # switching stores doesn't redirect (302), just acts like a link to
199
+ # another page (200) so the Set-Cookie header would be removed
200
+ return (pipe);
201
+ }
202
  if (req.http.X-Opt-Enable-Get-Excludes == "true" &&
203
  req.url ~ "(?:[?&](?:{{get_param_excludes}})(?=[&=]|$))") {
204
  return (pass);
235
  # make sure we give back the right encoding
236
  set req.hash += req.http.Accept-Encoding;
237
  }
238
+ # make sure data is for the right store and currency based on the *store*
239
+ # and *currency* cookies
240
+ set req.hash += "s=" req.http.X-Varnish-Store "&c=" req.http.X-Varnish-Currency;
241
  if (req.http.X-Varnish-Esi-Access == "private" &&
242
  req.http.Cookie ~ "frontend=") {
243
  set req.hash += regsub(req.http.Cookie, "^.*?frontend=([^;]*);*.*$", "\1");
349
  set resp.http.X-Varnish-Hits = obj.hits;
350
  set resp.http.X-Varnish-Esi-Method = req.http.X-Varnish-Esi-Method;
351
  set resp.http.X-Varnish-Esi-Access = req.http.X-Varnish-Esi-Access;
352
+ set resp.http.X-Varnish-Currency = req.http.X-Varnish-Currency;
353
+ set resp.http.X-Varnish-Store = req.http.X-Varnish-Store;
354
  } else {
355
  # remove Varnish fingerprints
356
  remove resp.http.X-Varnish;
360
  remove resp.http.X-Turpentine-Cache;
361
  remove resp.http.X-Turpentine-Esi;
362
  remove resp.http.X-Turpentine-Flush-Events;
363
+ remove resp.http.X-Turpentine-Block;
364
  remove resp.http.X-Varnish-Session;
365
  # this header indicates the session that originally generated a cached
366
  # page. it *must* not be sent to a client in production with lax
app/code/community/Nexcessnet/Turpentine/misc/version-3.vcl CHANGED
@@ -145,6 +145,14 @@ sub vcl_recv {
145
  set req.backend = admin;
146
  return (pipe);
147
  }
 
 
 
 
 
 
 
 
148
  # looks like an ESI request, add some extra vars for further processing
149
  if (req.url ~ "/turpentine/esi/getBlock/") {
150
  set req.http.X-Varnish-Esi-Method = regsub(
@@ -183,6 +191,12 @@ sub vcl_recv {
183
  if (req.url ~ "{{url_base_regex}}(?:{{url_excludes}})") {
184
  return (pipe);
185
  }
 
 
 
 
 
 
186
  if ({{enable_get_excludes}} &&
187
  req.url ~ "(?:[?&](?:{{get_param_excludes}})(?=[&=]|$))") {
188
  # TODO: should this be pass or pipe?
@@ -221,6 +235,9 @@ sub vcl_hash {
221
  # make sure we give back the right encoding
222
  hash_data(req.http.Accept-Encoding);
223
  }
 
 
 
224
  if (req.http.X-Varnish-Esi-Access == "private" &&
225
  req.http.Cookie ~ "frontend=") {
226
  hash_data(regsub(req.http.Cookie, "^.*?frontend=([^;]*);*.*$", "\1"));
@@ -334,6 +351,8 @@ sub vcl_deliver {
334
  set resp.http.X-Varnish-Hits = obj.hits;
335
  set resp.http.X-Varnish-Esi-Method = req.http.X-Varnish-Esi-Method;
336
  set resp.http.X-Varnish-Esi-Access = req.http.X-Varnish-Esi-Access;
 
 
337
  } else {
338
  # remove Varnish fingerprints
339
  unset resp.http.X-Varnish;
@@ -343,6 +362,7 @@ sub vcl_deliver {
343
  unset resp.http.X-Turpentine-Cache;
344
  unset resp.http.X-Turpentine-Esi;
345
  unset resp.http.X-Turpentine-Flush-Events;
 
346
  unset resp.http.X-Varnish-Session;
347
  # this header indicates the session that originally generated a cached
348
  # page. it *must* not be sent to a client in production with lax
145
  set req.backend = admin;
146
  return (pipe);
147
  }
148
+ if (req.http.Cookie ~ "\bcurrency=") {
149
+ set req.http.X-Varnish-Currency = regsub(
150
+ req.http.Cookie, ".*\bcurrency=([^;]*).*", "\1");
151
+ }
152
+ if (req.http.Cookie ~ "\bstore=") {
153
+ set req.http.X-Varnish-Store = regsub(
154
+ req.http.Cookie, ".*\bstore=([^;]*).*", "\1");
155
+ }
156
  # looks like an ESI request, add some extra vars for further processing
157
  if (req.url ~ "/turpentine/esi/getBlock/") {
158
  set req.http.X-Varnish-Esi-Method = regsub(
191
  if (req.url ~ "{{url_base_regex}}(?:{{url_excludes}})") {
192
  return (pipe);
193
  }
194
+ if (req.url ~ "\?.*__from_store=") {
195
+ # user switched stores. we pipe this instead of passing below because
196
+ # switching stores doesn't redirect (302), just acts like a link to
197
+ # another page (200) so the Set-Cookie header would be removed
198
+ return (pipe);
199
+ }
200
  if ({{enable_get_excludes}} &&
201
  req.url ~ "(?:[?&](?:{{get_param_excludes}})(?=[&=]|$))") {
202
  # TODO: should this be pass or pipe?
235
  # make sure we give back the right encoding
236
  hash_data(req.http.Accept-Encoding);
237
  }
238
+ # make sure data is for the right store and currency based on the *store*
239
+ # and *currency* cookies
240
+ hash_data("s=" + req.http.X-Varnish-Store + "&c=" + req.http.X-Varnish-Currency);
241
  if (req.http.X-Varnish-Esi-Access == "private" &&
242
  req.http.Cookie ~ "frontend=") {
243
  hash_data(regsub(req.http.Cookie, "^.*?frontend=([^;]*);*.*$", "\1"));
351
  set resp.http.X-Varnish-Hits = obj.hits;
352
  set resp.http.X-Varnish-Esi-Method = req.http.X-Varnish-Esi-Method;
353
  set resp.http.X-Varnish-Esi-Access = req.http.X-Varnish-Esi-Access;
354
+ set resp.http.X-Varnish-Currency = req.http.X-Varnish-Currency;
355
+ set resp.http.X-Varnish-Store = req.http.X-Varnish-Store;
356
  } else {
357
  # remove Varnish fingerprints
358
  unset resp.http.X-Varnish;
362
  unset resp.http.X-Turpentine-Cache;
363
  unset resp.http.X-Turpentine-Esi;
364
  unset resp.http.X-Turpentine-Flush-Events;
365
+ unset resp.http.X-Turpentine-Block;
366
  unset resp.http.X-Varnish-Session;
367
  # this header indicates the session that originally generated a cached
368
  # page. it *must* not be sent to a client in production with lax
app/design/frontend/base/default/layout/turpentine_esi.xml CHANGED
@@ -96,7 +96,8 @@
96
  </action>
97
  </reference>
98
 
99
- <!-- Messages are cached on a per-client basis -->
 
100
  <reference name="global_messages">
101
  <action method="setEsiOptions">
102
  <params>
@@ -151,10 +152,38 @@
151
  </reference>
152
  </customer_logged_in>
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  <!-- Checkout -->
155
 
156
  <!-- We cache the checkout cart page on a per-client basis -->
157
  <checkout_cart_index>
 
 
158
  <reference name="checkout.cart">
159
  <action method="setEsiOptions">
160
  <params>
@@ -165,6 +194,7 @@
165
  </params>
166
  </action>
167
  </reference>
 
168
  </checkout_cart_index>
169
 
170
  <!-- We never cache anything in the checkout funnel -->
96
  </action>
97
  </reference>
98
 
99
+ <!-- Messages are not cached because the "messages cleared" event is
100
+ not reliable -->
101
  <reference name="global_messages">
102
  <action method="setEsiOptions">
103
  <params>
152
  </reference>
153
  </customer_logged_in>
154
 
155
+ <!-- Catalog -->
156
+
157
+ <catalog_product_compare_index>
158
+ <!--
159
+ This ESI policy can be used to cache the product comparison popup
160
+ but since it's not likely to ever get a cache hit we just don't cache
161
+ the popup instead.
162
+ -->
163
+ <turpentine_cache_flag value="0"/>
164
+ <!--
165
+ <reference name="catalog.compare.list">
166
+ <action method="setEsiOptions">
167
+ <params>
168
+ <access>private</access>
169
+ <flush_events>
170
+ <catalog_product_compare_add_product/>
171
+ <catalog_product_compare_remove_product/>
172
+ <catalog_product_compare_item_collection_clear/>
173
+ </flush_events>
174
+ </params>
175
+ </action>
176
+ </reference>
177
+ -->
178
+ </catalog_product_compare_index>
179
+
180
+
181
  <!-- Checkout -->
182
 
183
  <!-- We cache the checkout cart page on a per-client basis -->
184
  <checkout_cart_index>
185
+ <turpentine_cache_flag value="0"/>
186
+ <!--
187
  <reference name="checkout.cart">
188
  <action method="setEsiOptions">
189
  <params>
194
  </params>
195
  </action>
196
  </reference>
197
+ -->
198
  </checkout_cart_index>
199
 
200
  <!-- We never cache anything in the checkout funnel -->
app/design/frontend/base/default/template/turpentine/esi.phtml CHANGED
@@ -24,10 +24,15 @@ $debugEnabled = (bool)Mage::helper( 'turpentine/esi' )->getEsiDebugEnabled();
24
  if( $debugEnabled ) {
25
  echo sprintf( '<!-- ESI START [%s] -->', $this->getNameInLayout() ) . PHP_EOL;
26
  echo sprintf( '<!-- ESI URL: %s -->', $this->getEsiUrl() ) . PHP_EOL;
 
 
 
27
  }
28
  echo sprintf( '<esi:remove>ESI processing not enabled</esi:remove>
29
  <!--esi <esi:include src="%s" /> -->',
30
  $this->getEsiUrl() ) . PHP_EOL;
31
  if( $debugEnabled ) {
32
  echo sprintf( '<!-- ESI END [%s] -->', $this->getNameInLayout() ) . PHP_EOL;
 
 
33
  }
24
  if( $debugEnabled ) {
25
  echo sprintf( '<!-- ESI START [%s] -->', $this->getNameInLayout() ) . PHP_EOL;
26
  echo sprintf( '<!-- ESI URL: %s -->', $this->getEsiUrl() ) . PHP_EOL;
27
+ } else {
28
+ echo '<!-- ESI START DUMMY COMMENT [] -->' . PHP_EOL;
29
+ echo '<!-- ESI URL DUMMY COMMENT -->' . PHP_EOL;
30
  }
31
  echo sprintf( '<esi:remove>ESI processing not enabled</esi:remove>
32
  <!--esi <esi:include src="%s" /> -->',
33
  $this->getEsiUrl() ) . PHP_EOL;
34
  if( $debugEnabled ) {
35
  echo sprintf( '<!-- ESI END [%s] -->', $this->getNameInLayout() ) . PHP_EOL;
36
+ } else {
37
+ echo '<!-- ESI END DUMMY COMMENT [] -->' . PHP_EOL;
38
  }
package.xml CHANGED
@@ -1 +1 @@
1
- <package><name>Nexcessnet_Turpentine</name><license uri="http://opensource.org/licenses/GPL-2.0">GPLv2</license><notes>Supports Magento v1.6 and later</notes><time>18:01:13</time><__packager>build_package.py v0.0.3</__packager><summary>Improves Magento support for Varnish caching and generates 2.1 and 3.0 compatible VCLs.</summary><stability>stable</stability><__commit_hash>b937ef3d23bba70d197d17b7a617db2ae81690c2</__commit_hash><version>0.5.2</version><extends /><contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file hash="a0bd4a5632b369b058c0ec5262e0cc49" name="turpentine.xml" /></dir><dir name="template"><dir name="turpentine"><file hash="b5cae58feecaec4b1c2e4558313c2a3f" name="varnish_management.phtml" /></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file hash="b93c82493edf2dfe0b554b587c0eda53" name="turpentine_esi.xml" /></dir><dir name="template"><dir name="turpentine"><file hash="4e3e5919b4eb862ac1f5e10a9bcea127" name="esi.phtml" /><file hash="1b337a1cbca5b87a77a3f2419a517d87" name="ajax.phtml" /></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file hash="58848d4d90973bfd63b466ea181352a5" name="Nexcessnet_Turpentine.xml" /></dir></target><target name="magecommunity"><dir name="Nexcessnet"><dir name="Turpentine"><dir name="controllers"><file hash="8013ce596f20d78973bc5f1876bc3a57" name="EsiController.php" /><dir name="Varnish"><file hash="9295d4020c36b22265cb43ecf8db9f36" name="ManagementController.php" /></dir></dir><dir name="Helper"><file hash="f87ce32f57c8f790790ebd63d287bd2d" name="Debug.php" /><file hash="2e43a7433dabf0a628cdbeef039c3395" name="Varnish.php" /><file hash="e91836f4e7967f026183cb5c87476775" name="Esi.php" /><file hash="77fffe4fc62f2e2bff62663182a47f06" name="Data.php" /><file hash="61b69cb98039441a01207a1aae6131f0" name="Cron.php" /><file hash="8f0dd23f9a7b98d8254acf18b6750f1e" name="Ban.php" /></dir><dir name="Model"><file hash="c2cb79001524617febbfddf099d09f37" name="Session.php" /><dir name="Observer"><file hash="9d57fad69ff42b71c66ca26bc3372317" name="Debug.php" /><file hash="d7e5901c0bc96e54685a3c9955fbe716" name="Varnish.php" /><file hash="1e05e2f8656afab31ed2d9e4fdf44737" name="Esi.php" /><file hash="a34e79218e8ca1fefad303b9399bda9d" name="Cron.php" /><file hash="7c164dc3b91790d513be1410f94f4071" name="Ban.php" /></dir><dir name="Config"><dir name="Select"><file hash="9348c5e58037fd97d89b84ccab4ef2d0" name="Toggle.php" /><file hash="dc472f34c25b1688cfa9fa206958c536" name="Version.php" /></dir></dir><dir name="Varnish"><file hash="fcb8a5582c6f920e910b417c671df6d2" name="Admin.php" /><dir name="Configurator"><file hash="970a058bf2a73a5774b004390fcfaa07" name="Version3.php" /><file hash="4fba0ac0b4837cabec5bbee428d229df" name="Version2.php" /><file hash="8075d99c4a59fffa37d733b7cd162ac6" name="Abstract.php" /></dir><dir name="Admin"><file hash="4399067515aaa22c8143148e891c92d2" name="Socket.php" /></dir></dir><dir name="Shim"><dir name="Mage"><dir name="Core"><file hash="821bff6c2fb372e3ffb39abf6453b3f8" name="Layout.php" /><file hash="5631df5e00de1fb5cbec5359457cb8bb" name="App.php" /></dir></dir></dir></dir><dir name="etc"><file hash="a963731e83c6e2cb440bf0c437a703da" name="config.xml" /><file hash="029e85a1387af95129f400e43eefe422" name="system.xml" /></dir><dir name="misc"><file hash="f083d5fbf4634af60ed5bb257197834f" name="uuid.c" /><file hash="adc3b270f3f708c04aa1a09a9e1a1494" name="version-2.vcl" /><file hash="3fcffc168124a1e93b942fef40af4e9c" name="version-3.vcl" /></dir><dir name="Block"><file hash="e517426e31404fb710c821d46085700f" name="Management.php" /><dir name="Core"><file hash="b64177f637923dbb06b95cb2ca42b675" name="Messages.php" /></dir></dir><dir name="sql" /></dir></dir></target></contents><dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies><authors><author><name>Chris Wells</name><user>nexcess_net</user><email>clwells@nexcess.net</email></author><author><name>Alex Headley</name><user>aheadley_nex</user><email>aheadley@nexcess.net</email></author></authors><date>2013-03-21</date><compatibile /><channel>community</channel><description>Turpentine is a Magento extension to improve Magento's compatibility with Varnish, a very-fast caching reverse-proxy. By default, Varnish doesn't cache requests with cookies and Magento sends the frontend cookie with every request causing a (near) zero hit-rate for Varnish's cache. Turpentine provides Varnish configuration files (VCLs) to work with Magento and modifies Magento's behaviour to significantly improve the cache hit rate.</description></package>
1
+ <package><name>Nexcessnet_Turpentine</name><license uri="http://opensource.org/licenses/GPL-2.0">GPLv2</license><notes>Supports Magento v1.6 and later</notes><time>17:57:38</time><__packager>build_package.py v0.0.3</__packager><summary>Improves Magento support for Varnish caching and generates 2.1 and 3.0 compatible VCLs.</summary><stability>stable</stability><__commit_hash>e286d48365bc1dfde23f9a2c2b382f72faa92ee2</__commit_hash><version>0.5.3</version><extends /><contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file hash="a0bd4a5632b369b058c0ec5262e0cc49" name="turpentine.xml" /></dir><dir name="template"><dir name="turpentine"><file hash="b5cae58feecaec4b1c2e4558313c2a3f" name="varnish_management.phtml" /></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file hash="460fbf2fa75b7a0090e339852d87a9fc" name="turpentine_esi.xml" /></dir><dir name="template"><dir name="turpentine"><file hash="b268c48251ccfccf5c775d3e85513584" name="esi.phtml" /><file hash="1b337a1cbca5b87a77a3f2419a517d87" name="ajax.phtml" /></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file hash="58848d4d90973bfd63b466ea181352a5" name="Nexcessnet_Turpentine.xml" /></dir></target><target name="magecommunity"><dir name="Nexcessnet"><dir name="Turpentine"><dir name="controllers"><file hash="2985fe63d9ae6ba19b475bc0fe236b49" name="EsiController.php" /><dir name="Varnish"><file hash="9295d4020c36b22265cb43ecf8db9f36" name="ManagementController.php" /></dir></dir><dir name="Helper"><file hash="2d7286c589b7a3e2f8fe873bd12afe3c" name="Debug.php" /><file hash="2c1523f274f5fcd32c77cce27541274b" name="Varnish.php" /><file hash="21af9e9fa2914b6cbe943ca2afec1eba" name="Esi.php" /><file hash="104f1bf79a0a67a1127be7c92c2978f3" name="Data.php" /><file hash="61b69cb98039441a01207a1aae6131f0" name="Cron.php" /><file hash="8f0dd23f9a7b98d8254acf18b6750f1e" name="Ban.php" /></dir><dir name="Model"><file hash="c2cb79001524617febbfddf099d09f37" name="Session.php" /><dir name="Observer"><file hash="9d57fad69ff42b71c66ca26bc3372317" name="Debug.php" /><file hash="7244a8ce600e980d612409595b9b6b9b" name="Varnish.php" /><file hash="a87d99e6fc21143745c49fe6691e462a" name="Esi.php" /><file hash="a34e79218e8ca1fefad303b9399bda9d" name="Cron.php" /><file hash="7c164dc3b91790d513be1410f94f4071" name="Ban.php" /></dir><dir name="Config"><dir name="Select"><file hash="9348c5e58037fd97d89b84ccab4ef2d0" name="Toggle.php" /><file hash="dc472f34c25b1688cfa9fa206958c536" name="Version.php" /></dir></dir><dir name="Varnish"><file hash="fcb8a5582c6f920e910b417c671df6d2" name="Admin.php" /><dir name="Configurator"><file hash="970a058bf2a73a5774b004390fcfaa07" name="Version3.php" /><file hash="4fba0ac0b4837cabec5bbee428d229df" name="Version2.php" /><file hash="8075d99c4a59fffa37d733b7cd162ac6" name="Abstract.php" /></dir><dir name="Admin"><file hash="d135441e2ef2ae08e2a195b7c6488c7e" name="Socket.php" /></dir></dir><dir name="Shim"><dir name="Mage"><dir name="Core"><file hash="821bff6c2fb372e3ffb39abf6453b3f8" name="Layout.php" /><file hash="94d91f8ff1005ce3bf14c4935945563c" name="App.php" /><file hash="43754654bc3bbd046154573efd735dfa" name="Config.php" /></dir></dir></dir></dir><dir name="etc"><file hash="269e5229980f4d061d81c1c632a7d5cd" name="config.xml" /><file hash="5e025bfca6f27f4e54aceaab2c2290b2" name="system.xml" /></dir><dir name="misc"><file hash="f083d5fbf4634af60ed5bb257197834f" name="uuid.c" /><file hash="17814ff0b6061d5a9d1eedde7cdd0704" name="version-2.vcl" /><file hash="481444c10a17bcf05bd32a0216bd0c5a" name="version-3.vcl" /></dir><dir name="Block"><file hash="e517426e31404fb710c821d46085700f" name="Management.php" /><dir name="Core"><file hash="21fac182c4c12a173e27118a7025d725" name="Messages.php" /></dir><dir name="Catalog"><dir name="Product"><dir name="List"><file hash="a3cc4b92cb6a4956e28da798eb9e17df" name="Toolbar.php" /></dir></dir></dir></dir><dir name="sql" /></dir></dir></target></contents><dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies><authors><author><name>Chris Wells</name><user>nexcess_net</user><email>clwells@nexcess.net</email></author><author><name>Alex Headley</name><user>aheadley_nex</user><email>aheadley@nexcess.net</email></author></authors><date>2013-04-03</date><compatibile /><channel>community</channel><description>Turpentine is a Magento extension to improve Magento's compatibility with Varnish, a very-fast caching reverse-proxy. By default, Varnish doesn't cache requests with cookies and Magento sends the frontend cookie with every request causing a (near) zero hit-rate for Varnish's cache. Turpentine provides Varnish configuration files (VCLs) to work with Magento and modifies Magento's behaviour to significantly improve the cache hit rate.</description></package>