@@ -298,37 +298,39 @@ public function banCacheType($eventObject) {
298
298
* @return bool
299
299
*/
300
300
public function banProductReview ($ eventObject ) {
301
- $ patterns = array ();
302
- /* @var $review \Mage_Review_Model_Review*/
303
- $ review = $ eventObject ->getObject ();
304
-
305
- /* @var $productCollection \Mage_Review_Model_Resource_Review_Product_Collection*/
306
- $ productCollection = $ review ->getProductCollection ();
307
-
308
- $ products = $ productCollection ->addEntityFilter ((int ) $ review ->getEntityPkValue ())->getItems ();
301
+ if (Mage::helper ('turpentine/varnish ' )->getVarnishEnabled ()) {
302
+ $ patterns = array ();
303
+ /* @var $review \Mage_Review_Model_Review*/
304
+ $ review = $ eventObject ->getObject ();
305
+
306
+ /* @var $productCollection \Mage_Review_Model_Resource_Review_Product_Collection*/
307
+ $ productCollection = $ review ->getProductCollection ();
308
+
309
+ $ products = $ productCollection ->addEntityFilter ((int ) $ review ->getEntityPkValue ())->getItems ();
309
310
310
- $ productIds = array_unique (array_map (
311
- create_function ('$p ' , 'return $p->getEntityId(); ' ),
312
- $ products ));
313
- $ patterns [] = sprintf ('/review/product/list/id/(?:%s)/category/ ' ,
314
- implode ('| ' , array_unique ($ productIds )));
315
- $ patterns [] = sprintf ('/review/product/view/id/%d/ ' ,
316
- $ review ->getEntityId ());
317
- $ productPatterns = array ();
318
- foreach ($ products as $ p ) {
319
- $ urlKey = $ p ->getUrlModel ()->formatUrlKey ($ p ->getName ());
320
- if ($ urlKey ) {
321
- $ productPatterns [] = $ urlKey ;
311
+ $ productIds = array_unique (array_map (
312
+ create_function ('$p ' , 'return $p->getEntityId(); ' ),
313
+ $ products ));
314
+ $ patterns [] = sprintf ('/review/product/list/id/(?:%s)/category/ ' ,
315
+ implode ('| ' , array_unique ($ productIds )));
316
+ $ patterns [] = sprintf ('/review/product/view/id/%d/ ' ,
317
+ $ review ->getEntityId ());
318
+ $ productPatterns = array ();
319
+ foreach ($ products as $ p ) {
320
+ $ urlKey = $ p ->getUrlModel ()->formatUrlKey ($ p ->getName ());
321
+ if ($ urlKey ) {
322
+ $ productPatterns [] = $ urlKey ;
323
+ }
322
324
}
323
- }
324
- if ( ! empty ($ productPatterns )) {
325
- $ productPatterns = array_unique ($ productPatterns );
326
- $ patterns [] = sprintf ('(?:%s) ' , implode ('| ' , $ productPatterns ));
327
- }
328
- $ urlPattern = implode ('| ' , $ patterns );
325
+ if ( ! empty ($ productPatterns )) {
326
+ $ productPatterns = array_unique ($ productPatterns );
327
+ $ patterns [] = sprintf ('(?:%s) ' , implode ('| ' , $ productPatterns ));
328
+ }
329
+ $ urlPattern = implode ('| ' , $ patterns );
329
330
330
- $ result = $ this ->_getVarnishAdmin ()->flushUrl ($ urlPattern );
331
- return $ this ->_checkResult ($ result );
331
+ $ result = $ this ->_getVarnishAdmin ()->flushUrl ($ urlPattern );
332
+ return $ this ->_checkResult ($ result );
333
+ }
332
334
}
333
335
334
336
/**
0 commit comments