Version Notes
Added a category purge option on the Edit Category screen.
Fixed a bug that was introduced in 1.2.0 that affected crawling urls with a cache vary.
Fixed a bug where the crawler sometimes did not work properly when setting the LiteMage Server IP.
Fixed a bug that occurred when user agent theme exceptions were added for the template and skin, but not added for the layout.
Download this release
Release Info
Developer | LiteSpeed Technologies |
Extension | LiteSpeed_LiteMage |
Version | 1.2.3 |
Comparing to | |
See all releases |
Code changes from version 1.2.2 to 1.2.3
- app/code/community/Litespeed/Litemage/Block/Adminhtml/ItemSave.php +37 -11
- app/code/community/Litespeed/Litemage/Helper/Esi.php +9 -1
- app/code/community/Litespeed/Litemage/Model/Observer/Cron.php +29 -27
- app/code/community/Litespeed/Litemage/Model/Observer/Esi.php +1 -1
- app/code/community/Litespeed/Litemage/Model/Observer/Purge.php +46 -3
- app/code/community/Litespeed/Litemage/controllers/Adminhtml/LitemageCacheController.php +42 -3
- app/code/community/Litespeed/Litemage/controllers/EsiController.php +13 -2
- app/code/community/Litespeed/Litemage/etc/config.xml +1 -1
- app/code/community/Litespeed/Litemage/etc/system.xml +1 -1
- app/design/adminhtml/default/default/template/litemage/category_save.phtml +23 -4
- app/design/adminhtml/default/default/template/litemage/product_save.phtml +3 -3
- package.xml +8 -5
app/code/community/Litespeed/Litemage/Block/Adminhtml/ItemSave.php
CHANGED
@@ -27,9 +27,10 @@
|
|
27 |
class Litespeed_Litemage_Block_Adminhtml_ItemSave extends Mage_Adminhtml_Block_Template
|
28 |
{
|
29 |
const SAVE_PROD_SESSION_KEY = 'litemage_admin_saveprod';
|
|
|
30 |
|
31 |
public function getProductSaveOptionUrl()
|
32 |
-
|
33 |
if (($product = Mage::registry('product')) == null) {
|
34 |
$product = Mage::registry('current_product');
|
35 |
}
|
@@ -40,6 +41,11 @@ class Litespeed_Litemage_Block_Adminhtml_ItemSave extends Mage_Adminhtml_Block_T
|
|
40 |
return null;
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
|
|
43 |
public function getCurrentProdSaveOptions()
|
44 |
{
|
45 |
$session = Mage::getSingleton('admin/session');
|
@@ -52,18 +58,27 @@ class Litespeed_Litemage_Block_Adminhtml_ItemSave extends Mage_Adminhtml_Block_T
|
|
52 |
$options = array('c' => $lmhelper->__('For This Product and Related Parent Categories'),
|
53 |
'p' => $lmhelper->__('For This Product Only'),
|
54 |
'n' => $lmhelper->__('Do Not Purge'));
|
55 |
-
$
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
62 |
}
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
|
66 |
-
|
67 |
* Check if block can be displayed
|
68 |
*
|
69 |
* @return bool
|
@@ -78,6 +93,17 @@ class Litespeed_Litemage_Block_Adminhtml_ItemSave extends Mage_Adminhtml_Block_T
|
|
78 |
return Mage::app()->useCache('layout') && Mage::app()->useCache('config');
|
79 |
}
|
80 |
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
}
|
27 |
class Litespeed_Litemage_Block_Adminhtml_ItemSave extends Mage_Adminhtml_Block_Template
|
28 |
{
|
29 |
const SAVE_PROD_SESSION_KEY = 'litemage_admin_saveprod';
|
30 |
+
const SAVE_CAT_SESSION_KEY = 'litemage_admin_savecat';
|
31 |
|
32 |
public function getProductSaveOptionUrl()
|
33 |
+
{
|
34 |
if (($product = Mage::registry('product')) == null) {
|
35 |
$product = Mage::registry('current_product');
|
36 |
}
|
41 |
return null;
|
42 |
}
|
43 |
|
44 |
+
public function getCategoryPurgeUrl()
|
45 |
+
{
|
46 |
+
return $this->getUrl('*/litemageCache/categorySaveOption');
|
47 |
+
}
|
48 |
+
|
49 |
public function getCurrentProdSaveOptions()
|
50 |
{
|
51 |
$session = Mage::getSingleton('admin/session');
|
58 |
$options = array('c' => $lmhelper->__('For This Product and Related Parent Categories'),
|
59 |
'p' => $lmhelper->__('For This Product Only'),
|
60 |
'n' => $lmhelper->__('Do Not Purge'));
|
61 |
+
return $this->_getSelectOptions($options, $cur);
|
62 |
+
}
|
63 |
+
|
64 |
+
public function getCurrentCatSaveOptions()
|
65 |
+
{
|
66 |
+
$session = Mage::getSingleton('admin/session');
|
67 |
+
if (!$session->getData(self::SAVE_CAT_SESSION_KEY)) {
|
68 |
+
$session->setData(self::SAVE_CAT_SESSION_KEY, 'c');
|
69 |
}
|
70 |
+
$cur = $session->getData(self::SAVE_CAT_SESSION_KEY);
|
71 |
+
|
72 |
+
$lmhelper = Mage::helper('litemage/data');
|
73 |
+
$options = array( 'n' => $lmhelper->__('Not purge anything'),
|
74 |
+
'c' => $lmhelper->__('Purge this category'),
|
75 |
+
's' => $lmhelper->__('Purge this category and its sub-categories'),
|
76 |
+
'p' => $lmhelper->__('Purge this category and its parent categories'),
|
77 |
+
'a' => $lmhelper->__('Purge this category and its parent and sub-categories'));
|
78 |
+
return $this->_getSelectOptions($options, $cur);
|
79 |
}
|
80 |
|
81 |
+
/**
|
82 |
* Check if block can be displayed
|
83 |
*
|
84 |
* @return bool
|
93 |
return Mage::app()->useCache('layout') && Mage::app()->useCache('config');
|
94 |
}
|
95 |
|
96 |
+
protected function _getSelectOptions($options, $current)
|
97 |
+
{
|
98 |
+
$buf = '';
|
99 |
+
foreach($options as $k => $v) {
|
100 |
+
$buf .= '<option value="' . $k . '"';
|
101 |
+
if ($k == $current) {
|
102 |
+
$buf .= ' selected';
|
103 |
+
}
|
104 |
+
$buf .= '>' . $v . '</option>';
|
105 |
+
}
|
106 |
+
return $buf;
|
107 |
+
}
|
108 |
|
109 |
}
|
app/code/community/Litespeed/Litemage/Helper/Esi.php
CHANGED
@@ -1100,11 +1100,19 @@ class Litespeed_Litemage_Helper_Esi
|
|
1100 |
{
|
1101 |
if (!isset($this->_cacheVars['esiUrlSharedParams'])) {
|
1102 |
$design = Mage::getDesign() ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1103 |
$currStore = Mage::app()->getStore() ;
|
1104 |
$urlParams = array(
|
1105 |
's' => $currStore->getId(), // current store id
|
1106 |
'dp' => $design->getPackageName(),
|
1107 |
-
'dt' => $
|
1108 |
|
1109 |
$currency = $currStore->getCurrentCurrencyCode();
|
1110 |
if ($currency != $currStore->getDefaultCurrencyCode()) {
|
1100 |
{
|
1101 |
if (!isset($this->_cacheVars['esiUrlSharedParams'])) {
|
1102 |
$design = Mage::getDesign() ;
|
1103 |
+
$theme_template = $design->getTheme('template') ;
|
1104 |
+
$theme_skin = $design->getTheme('skin') ;
|
1105 |
+
$theme_layout = $design->getTheme('layout') ;
|
1106 |
+
$dt = $theme_template;
|
1107 |
+
if ($theme_skin != $theme_template || $theme_layout != $theme_template) {
|
1108 |
+
$dt .= ',' . $theme_skin . ',' . $theme_layout;
|
1109 |
+
}
|
1110 |
+
|
1111 |
$currStore = Mage::app()->getStore() ;
|
1112 |
$urlParams = array(
|
1113 |
's' => $currStore->getId(), // current store id
|
1114 |
'dp' => $design->getPackageName(),
|
1115 |
+
'dt' => $dt ) ;
|
1116 |
|
1117 |
$currency = $currStore->getCurrentCurrencyCode();
|
1118 |
if ($currency != $currStore->getDefaultCurrencyCode()) {
|
app/code/community/Litespeed/Litemage/Model/Observer/Cron.php
CHANGED
@@ -195,6 +195,7 @@ class Litespeed_Litemage_Model_Observer_Cron extends Varien_Event_Observer
|
|
195 |
|
196 |
$options = array(
|
197 |
CURLOPT_SSL_VERIFYPEER => 0,
|
|
|
198 |
CURLOPT_TIMEOUT => 180
|
199 |
) ;
|
200 |
|
@@ -227,7 +228,7 @@ class Litespeed_Litemage_Model_Observer_Cron extends Varien_Event_Observer
|
|
227 |
$domain = $m[1];
|
228 |
$pos = strpos($url, $domain);
|
229 |
$url2 = substr($url, 0, $pos) . $server_ip . substr($url, $pos + strlen($domain));
|
230 |
-
$curlOptions[CURLOPT_HTTPHEADER] =
|
231 |
}
|
232 |
else {
|
233 |
if ( $this->_isDebug ) {
|
@@ -346,25 +347,7 @@ class Litespeed_Litemage_Model_Observer_Cron extends Varien_Event_Observer
|
|
346 |
}
|
347 |
|
348 |
$m = &$this->_meta[$id] ;
|
349 |
-
|
350 |
-
$vary = array() ;
|
351 |
-
$fixed = 'litemage_cron=' . $id . ';' ;
|
352 |
-
$fixed .= $this->_parseEnvCookies($m['env'], $vary) ;
|
353 |
-
if ( ! in_array($m['curvary'], $vary) || $m['curpos'] > $m['listsize'] ) {
|
354 |
-
// reset current pointer
|
355 |
-
$m['curvary'] = $vary[0] ;
|
356 |
-
$m['curpos'] = 0 ;
|
357 |
-
if ( $this->_isDebug ) {
|
358 |
-
$this->_debugLog('Reset current position pointer to 0. curvary is ' . $m['curvary']) ;
|
359 |
-
}
|
360 |
-
}
|
361 |
-
|
362 |
-
while ( ! empty($vary) && ($m['curvary'] != $vary[0]) ) {
|
363 |
-
array_shift($vary) ;
|
364 |
-
}
|
365 |
-
|
366 |
-
$this->_curList = array(
|
367 |
-
'id' => $id, 'fixed' => $fixed, 'vary' => $vary, 'working' => 0 ) ;
|
368 |
|
369 |
if ( $m['gentime'] > 0 && $m['endtime'] == 0 && ($urls = $this->_getCrawlListFileData($id))
|
370 |
!= null ) {
|
@@ -385,13 +368,34 @@ class Litespeed_Litemage_Model_Observer_Cron extends Varien_Event_Observer
|
|
385 |
$this->_curList['urls'] = $this->_generateUrlList($id) ;
|
386 |
}
|
387 |
|
388 |
-
if ( $m['listsize']
|
389 |
-
return true ;
|
390 |
-
}
|
391 |
-
else {
|
392 |
// get next list
|
393 |
return $this->_prepareCurList() ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
}
|
396 |
|
397 |
protected function _prepareDeltaList()
|
@@ -431,7 +435,7 @@ class Litespeed_Litemage_Model_Observer_Cron extends Varien_Event_Observer
|
|
431 |
foreach ($ud as $url => $data) {
|
432 |
if (($level == 0 && count($u) == 0) // always include first one
|
433 |
|| (($data[1] & 28) > 0 ) // auto+cust+store = 16+8+4 = 28, from crawler list
|
434 |
-
|| ($data[0] >
|
435 |
$u[] = $url;
|
436 |
}
|
437 |
}
|
@@ -539,7 +543,6 @@ class Litespeed_Litemage_Model_Observer_Cron extends Varien_Event_Observer
|
|
539 |
else {
|
540 |
$vary[] = '' ; // no vary
|
541 |
}
|
542 |
-
|
543 |
return $fixed ;
|
544 |
}
|
545 |
|
@@ -555,7 +558,6 @@ class Litespeed_Litemage_Model_Observer_Cron extends Varien_Event_Observer
|
|
555 |
return null ;
|
556 |
}
|
557 |
}
|
558 |
-
|
559 |
$isAutoList = ($id{0} == 'a');
|
560 |
$curpos = $this->_meta[$id]['curpos'] ;
|
561 |
$curCookie = $this->_curList['fixed'] . $this->_meta[$id]['curvary'] ;
|
195 |
|
196 |
$options = array(
|
197 |
CURLOPT_SSL_VERIFYPEER => 0,
|
198 |
+
CURLOPT_SSL_VERIFYHOST => 0,
|
199 |
CURLOPT_TIMEOUT => 180
|
200 |
) ;
|
201 |
|
228 |
$domain = $m[1];
|
229 |
$pos = strpos($url, $domain);
|
230 |
$url2 = substr($url, 0, $pos) . $server_ip . substr($url, $pos + strlen($domain));
|
231 |
+
$curlOptions[CURLOPT_HTTPHEADER][] = "Host: $domain";
|
232 |
}
|
233 |
else {
|
234 |
if ( $this->_isDebug ) {
|
347 |
}
|
348 |
|
349 |
$m = &$this->_meta[$id] ;
|
350 |
+
$this->_curList = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
|
352 |
if ( $m['gentime'] > 0 && $m['endtime'] == 0 && ($urls = $this->_getCrawlListFileData($id))
|
353 |
!= null ) {
|
368 |
$this->_curList['urls'] = $this->_generateUrlList($id) ;
|
369 |
}
|
370 |
|
371 |
+
if ( $m['listsize'] == 0 ) {
|
|
|
|
|
|
|
372 |
// get next list
|
373 |
return $this->_prepareCurList() ;
|
374 |
+
}
|
375 |
+
|
376 |
+
// parse env & get all possible varies
|
377 |
+
$vary = array() ;
|
378 |
+
$fixed = 'litemage_cron=' . $id . ';' ;
|
379 |
+
$fixed .= $this->_parseEnvCookies($m['env'], $vary) ;
|
380 |
+
if ( ! in_array($m['curvary'], $vary) || $m['curpos'] > $m['listsize'] ) {
|
381 |
+
// reset current pointer
|
382 |
+
$m['curvary'] = $vary[0] ;
|
383 |
+
$m['curpos'] = 0 ;
|
384 |
+
if ( $this->_isDebug ) {
|
385 |
+
$this->_debugLog('Reset current position pointer to 0. curvary is ' . $m['curvary']) ;
|
386 |
+
}
|
387 |
}
|
388 |
+
|
389 |
+
while ( ! empty($vary) && ($m['curvary'] != $vary[0]) ) {
|
390 |
+
array_shift($vary) ;
|
391 |
+
}
|
392 |
+
|
393 |
+
$this->_curList['id'] = $id;
|
394 |
+
$this->_curList['fixed'] = $fixed;
|
395 |
+
$this->_curList['vary'] = $vary;
|
396 |
+
$this->_curList['working'] = 0;
|
397 |
+
|
398 |
+
return true ;
|
399 |
}
|
400 |
|
401 |
protected function _prepareDeltaList()
|
435 |
foreach ($ud as $url => $data) {
|
436 |
if (($level == 0 && count($u) == 0) // always include first one
|
437 |
|| (($data[1] & 28) > 0 ) // auto+cust+store = 16+8+4 = 28, from crawler list
|
438 |
+
|| ($data[0] > 10)) { // or visitor count > 10 (hard coded number for now)
|
439 |
$u[] = $url;
|
440 |
}
|
441 |
}
|
543 |
else {
|
544 |
$vary[] = '' ; // no vary
|
545 |
}
|
|
|
546 |
return $fixed ;
|
547 |
}
|
548 |
|
558 |
return null ;
|
559 |
}
|
560 |
}
|
|
|
561 |
$isAutoList = ($id{0} == 'a');
|
562 |
$curpos = $this->_meta[$id]['curpos'] ;
|
563 |
$curCookie = $this->_curList['fixed'] . $this->_meta[$id]['curvary'] ;
|
app/code/community/Litespeed/Litemage/Model/Observer/Esi.php
CHANGED
@@ -343,7 +343,7 @@ class Litespeed_Litemage_Model_Observer_Esi extends Varien_Event_Observer
|
|
343 |
$tags = array($actionName);
|
344 |
$tags[] = $app->getStore()->getId() ;
|
345 |
$tags[] = $design->getPackageName();
|
346 |
-
$tags[] = $design->getTheme('layout');
|
347 |
$cacheId = 'LITEMAGE_ROUTE_' . md5(join('__', $tags));
|
348 |
|
349 |
$this->_routeCache = array('actionName' => $actionName, 'cacheId' => $cacheId);
|
343 |
$tags = array($actionName);
|
344 |
$tags[] = $app->getStore()->getId() ;
|
345 |
$tags[] = $design->getPackageName();
|
346 |
+
$tags[] = $design->getTheme('layout') . '_' . $design->getTheme('template') . '_' . $design->getTheme('skin');
|
347 |
$cacheId = 'LITEMAGE_ROUTE_' . md5(join('__', $tags));
|
348 |
|
349 |
$this->_routeCache = array('actionName' => $actionName, 'cacheId' => $cacheId);
|
app/code/community/Litespeed/Litemage/Model/Observer/Purge.php
CHANGED
@@ -131,6 +131,7 @@ class Litespeed_Litemage_Model_Observer_Purge extends Varien_Event_Observer
|
|
131 |
public function purgeTrigger($eventObj)
|
132 |
{
|
133 |
// array('action'=>'admin_prod_save', 'option'=>$curOption, 'id'=>$id)
|
|
|
134 |
$action = $eventObj->getAction();
|
135 |
$option = $eventObj->getOption();
|
136 |
$id = $eventObj->getId();
|
@@ -150,12 +151,24 @@ class Litespeed_Litemage_Model_Observer_Purge extends Varien_Event_Observer
|
|
150 |
}
|
151 |
|
152 |
}
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
}
|
155 |
|
156 |
Mage::helper('litemage/data')->debugMesg($reason);
|
157 |
if (!empty($tags)) {
|
158 |
Mage::helper('litemage/esi')->setPurgeHeader($tags, $reason) ;
|
|
|
159 |
}
|
160 |
}
|
161 |
|
@@ -195,10 +208,19 @@ class Litespeed_Litemage_Model_Observer_Purge extends Varien_Event_Observer
|
|
195 |
{
|
196 |
try {
|
197 |
if ( Mage::helper('litemage/data')->moduleEnabled() ) {
|
|
|
|
|
|
|
|
|
198 |
$category = $eventObj->getEvent()->getCategory() ;
|
199 |
if ( $category != null ) {
|
200 |
-
|
201 |
-
|
|
|
|
|
|
|
|
|
|
|
202 |
}
|
203 |
}
|
204 |
} catch ( Exception $e ) {
|
@@ -321,6 +343,27 @@ class Litespeed_Litemage_Model_Observer_Purge extends Varien_Event_Observer
|
|
321 |
}
|
322 |
}
|
323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
protected function _getPurgeProductTags( $product, $purgeCategory )
|
325 |
{
|
326 |
$productId = $product->getId() ;
|
131 |
public function purgeTrigger($eventObj)
|
132 |
{
|
133 |
// array('action'=>'admin_prod_save', 'option'=>$curOption, 'id'=>$id)
|
134 |
+
// array('action'=>'admin_cat_purge', 'option'=>$option, 'id'=>$id));
|
135 |
$action = $eventObj->getAction();
|
136 |
$option = $eventObj->getOption();
|
137 |
$id = $eventObj->getId();
|
151 |
}
|
152 |
|
153 |
}
|
154 |
+
}
|
155 |
+
elseif ($action == 'admin_cat_purge') {
|
156 |
+
if ($option == 'c') {
|
157 |
+
$tags[] = Litespeed_Litemage_Helper_Esi::TAG_PREFIX_CATEGORY . $id ;
|
158 |
+
}
|
159 |
+
else {
|
160 |
+
$category = Mage::getModel('catalog/category')->load($id);
|
161 |
+
if ($category) {
|
162 |
+
$tags = $this->_getPurgeCatTags($category, $option);
|
163 |
+
}
|
164 |
+
}
|
165 |
+
$message = 'category ' . implode(', ', $tags);
|
166 |
}
|
167 |
|
168 |
Mage::helper('litemage/data')->debugMesg($reason);
|
169 |
if (!empty($tags)) {
|
170 |
Mage::helper('litemage/esi')->setPurgeHeader($tags, $reason) ;
|
171 |
+
$this->_getAdminSession()->addSuccess(Mage::helper('litemage/data')->__('Notified LiteSpeed web server to purge ' . $message)) ;
|
172 |
}
|
173 |
}
|
174 |
|
208 |
{
|
209 |
try {
|
210 |
if ( Mage::helper('litemage/data')->moduleEnabled() ) {
|
211 |
+
$curOption = Mage::getSingleton('admin/session')->getData(Litespeed_Litemage_Block_Adminhtml_ItemSave::SAVE_CAT_SESSION_KEY);
|
212 |
+
if ($curOption == 'n') { // no purge
|
213 |
+
return;
|
214 |
+
}
|
215 |
$category = $eventObj->getEvent()->getCategory() ;
|
216 |
if ( $category != null ) {
|
217 |
+
$tags = $this->_getPurgeCatTags($category, $curOption);
|
218 |
+
$msg = array('c' => 'this category',
|
219 |
+
's' => 'this category and its sub-categories',
|
220 |
+
'p' => 'this category and its parent categories',
|
221 |
+
'a' => 'this category and its parent and sub-categories'
|
222 |
+
);
|
223 |
+
$this->_purgeTagByAdmin($tags, $msg[$curOption]) ;
|
224 |
}
|
225 |
}
|
226 |
} catch ( Exception $e ) {
|
343 |
}
|
344 |
}
|
345 |
|
346 |
+
protected function _getPurgeCatTags($category, $option)
|
347 |
+
{
|
348 |
+
$tags = array();
|
349 |
+
if ($option != 'n') {
|
350 |
+
$tags[] = Litespeed_Litemage_Helper_Esi::TAG_PREFIX_CATEGORY . $category->getId() ;
|
351 |
+
}
|
352 |
+
if ($option == 's' || $option == 'a') {
|
353 |
+
$sub = $category->getAllChildren(true);
|
354 |
+
foreach ($sub as $sid) {
|
355 |
+
$tags[] = Litespeed_Litemage_Helper_Esi::TAG_PREFIX_CATEGORY . $sid ;
|
356 |
+
}
|
357 |
+
}
|
358 |
+
if ($option == 'p' || $option == 'a') {
|
359 |
+
$pids = $category->getParentIds();
|
360 |
+
foreach ($pids as $pid) {
|
361 |
+
$tags[] = Litespeed_Litemage_Helper_Esi::TAG_PREFIX_CATEGORY . $pid ;
|
362 |
+
}
|
363 |
+
}
|
364 |
+
return array_unique($tags);
|
365 |
+
}
|
366 |
+
|
367 |
protected function _getPurgeProductTags( $product, $purgeCategory )
|
368 |
{
|
369 |
$productId = $product->getId() ;
|
app/code/community/Litespeed/Litemage/controllers/Adminhtml/LitemageCacheController.php
CHANGED
@@ -73,8 +73,8 @@ class Litespeed_Litemage_Adminhtml_LitemageCacheController extends Mage_Adminhtm
|
|
73 |
Mage::dispatchEvent('litemage_purge_trigger',
|
74 |
array('action'=>'admin_prod_save', 'option'=>'c', 'id'=>$id));
|
75 |
}
|
76 |
-
elseif ($req->getParam('
|
77 |
-
$option = $req->getParam('
|
78 |
if (in_array($option, array('c','p','n'))) {
|
79 |
$session->setData(Litespeed_Litemage_Block_Adminhtml_ItemSave::SAVE_PROD_SESSION_KEY, $option);
|
80 |
}
|
@@ -82,7 +82,46 @@ class Litespeed_Litemage_Adminhtml_LitemageCacheController extends Mage_Adminhtm
|
|
82 |
$this->_redirect('*/catalog_product/edit', array('id'=>$id));
|
83 |
}
|
84 |
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
{
|
87 |
return Mage::getSingleton('admin/session')->isAllowed('system/cache/litemage');
|
88 |
}
|
73 |
Mage::dispatchEvent('litemage_purge_trigger',
|
74 |
array('action'=>'admin_prod_save', 'option'=>'c', 'id'=>$id));
|
75 |
}
|
76 |
+
elseif ($req->getParam('litemage_prodpurgeoption')) {
|
77 |
+
$option = $req->getParam('litemage_prodpurgeoption');
|
78 |
if (in_array($option, array('c','p','n'))) {
|
79 |
$session->setData(Litespeed_Litemage_Block_Adminhtml_ItemSave::SAVE_PROD_SESSION_KEY, $option);
|
80 |
}
|
82 |
$this->_redirect('*/catalog_product/edit', array('id'=>$id));
|
83 |
}
|
84 |
|
85 |
+
public function categorySaveOptionAction()
|
86 |
+
{
|
87 |
+
$req = $this->getRequest();
|
88 |
+
$session = Mage::getSingleton('admin/session');
|
89 |
+
$id = $session->getLastEditedCategory(false);
|
90 |
+
$params = array( 'id' => $id);
|
91 |
+
$storeId = (int) $req->getParam('store');
|
92 |
+
$parentId = (int) $req->getParam('parent');
|
93 |
+
$prevStoreId = $session->getLastViewedStore(false);
|
94 |
+
if (!empty($prevStoreId)) {
|
95 |
+
$storeId = $prevStoreId;
|
96 |
+
}
|
97 |
+
if (!empty($storeId)) {
|
98 |
+
$params['store'] = $storeId;
|
99 |
+
}
|
100 |
+
if (!empty($parentId))
|
101 |
+
$params['parent'] = $parentId;
|
102 |
+
|
103 |
+
if ($req->getParam('saveoption')) {
|
104 |
+
$option = $req->getParam('saveoption');
|
105 |
+
if (in_array($option, array('c','s','p','a','n'))) {
|
106 |
+
$session->setData(Litespeed_Litemage_Block_Adminhtml_ItemSave::SAVE_CAT_SESSION_KEY, $option);
|
107 |
+
}
|
108 |
+
}
|
109 |
+
else if ($req->getParam('useoption')) {
|
110 |
+
$use = $req->getParam('useoption');
|
111 |
+
$option = 'c';
|
112 |
+
if ($use == 2) {
|
113 |
+
$option = $session->getData(Litespeed_Litemage_Block_Adminhtml_ItemSave::SAVE_CAT_SESSION_KEY);
|
114 |
+
}
|
115 |
+
if ($option != 'n') {
|
116 |
+
Mage::dispatchEvent('litemage_purge_trigger',
|
117 |
+
array('action'=>'admin_cat_purge', 'option'=>$option, 'id'=>$id));
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
$this->_forward('edit', 'catalog_category',null,$params);
|
122 |
+
}
|
123 |
+
|
124 |
+
protected function _isAllowed()
|
125 |
{
|
126 |
return Mage::getSingleton('admin/session')->isAllowed('system/cache/litemage');
|
127 |
}
|
app/code/community/Litespeed/Litemage/controllers/EsiController.php
CHANGED
@@ -529,8 +529,19 @@ class Litespeed_Litemage_EsiController extends Mage_Core_Controller_Front_Action
|
|
529 |
if ( $action == Litespeed_Litemage_Model_EsiData::ACTION_LOG ) {
|
530 |
return ; // only need to set store
|
531 |
}
|
532 |
-
|
533 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
534 |
|
535 |
$curLocale = $app->getLocale() ;
|
536 |
$locale = Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE) ;
|
529 |
if ( $action == Litespeed_Litemage_Model_EsiData::ACTION_LOG ) {
|
530 |
return ; // only need to set store
|
531 |
}
|
532 |
+
$design= Mage::getDesign();
|
533 |
+
$design->setPackageName($d['dp']);
|
534 |
+
$dt = explode(',', $d['dt']);
|
535 |
+
if (count($dt) == 1) {
|
536 |
+
$design->setTheme($dt[0]) ;
|
537 |
+
}
|
538 |
+
else {
|
539 |
+
$design->setTheme('template', $dt[0]);
|
540 |
+
if ($dt[1])
|
541 |
+
$design->setTheme('skin', $dt[1]);
|
542 |
+
if ($dt[2])
|
543 |
+
$design->setTheme('layout', $dt[2]);
|
544 |
+
}
|
545 |
|
546 |
$curLocale = $app->getLocale() ;
|
547 |
$locale = Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE) ;
|
app/code/community/Litespeed/Litemage/etc/config.xml
CHANGED
@@ -26,7 +26,7 @@
|
|
26 |
<config>
|
27 |
<modules>
|
28 |
<Litespeed_Litemage>
|
29 |
-
<version>1.2.
|
30 |
</Litespeed_Litemage>
|
31 |
</modules>
|
32 |
<global>
|
26 |
<config>
|
27 |
<modules>
|
28 |
<Litespeed_Litemage>
|
29 |
+
<version>1.2.3</version>
|
30 |
</Litespeed_Litemage>
|
31 |
</modules>
|
32 |
<global>
|
app/code/community/Litespeed/Litemage/etc/system.xml
CHANGED
@@ -27,7 +27,7 @@
|
|
27 |
<config>
|
28 |
<tabs>
|
29 |
<Litespeed_Litemage translate="label">
|
30 |
-
<label>LiteMage Cache 1.2.
|
31 |
<sort_order>5000</sort_order>
|
32 |
</Litespeed_Litemage>
|
33 |
</tabs>
|
27 |
<config>
|
28 |
<tabs>
|
29 |
<Litespeed_Litemage translate="label">
|
30 |
+
<label>LiteMage Cache 1.2.3</label>
|
31 |
<sort_order>5000</sort_order>
|
32 |
</Litespeed_Litemage>
|
33 |
</tabs>
|
app/design/adminhtml/default/default/template/litemage/category_save.phtml
CHANGED
@@ -23,16 +23,35 @@
|
|
23 |
*/
|
24 |
|
25 |
if ($this->canShowButton()):
|
|
|
26 |
//$lmhelper = Mage::helper('litemage/data');
|
27 |
?>
|
28 |
<br/>
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
</li>
|
34 |
</ul></div>
|
35 |
|
36 |
<?php
|
37 |
endif;
|
|
|
38 |
?>
|
23 |
*/
|
24 |
|
25 |
if ($this->canShowButton()):
|
26 |
+
if ($catsaveurl = $this->getCategoryPurgeUrl()) :
|
27 |
//$lmhelper = Mage::helper('litemage/data');
|
28 |
?>
|
29 |
<br/>
|
30 |
+
<script type="text/javascript">
|
31 |
+
//<![CDATA[
|
32 |
+
function lmcategoryPurge(useoption) {
|
33 |
+
updateContent("<?php echo $catsaveurl; ?>", {'useoption':useoption}, false);
|
34 |
+
}
|
35 |
+
function lmcategorySaveOption(sel) {
|
36 |
+
updateContent("<?php echo $catsaveurl; ?>", {'saveoption':sel.value}, false);
|
37 |
+
}
|
38 |
+
//]]>
|
39 |
+
</script>
|
40 |
+
<div class="entry-edit">
|
41 |
+
<ul class="messages">
|
42 |
+
<li class="notice-msg">
|
43 |
+
LiteMage Cache: Clicking the "Save Category" Button Will
|
44 |
+
<select name="litemage_catsaveoption" onchange="lmcategorySaveOption(this)">
|
45 |
+
<?php echo $this->getCurrentCatSaveOptions(); ?>
|
46 |
+
</select>
|
47 |
+
<div class="form-buttons">
|
48 |
+
<input type="button" onclick="lmcategoryPurge(1)" class="form-button" name="litemage_purgecat" value="Purge This Category" id="litemage_purgecat" />
|
49 |
+
<input type="button" onclick="lmcategoryPurge(2)" class="form-button" name="litemage_purgecats" value="Purge with Selected Options" id="litemage_purgepcats" />
|
50 |
+
</div>
|
51 |
</li>
|
52 |
</ul></div>
|
53 |
|
54 |
<?php
|
55 |
endif;
|
56 |
+
endif;
|
57 |
?>
|
app/design/adminhtml/default/default/template/litemage/product_save.phtml
CHANGED
@@ -23,17 +23,17 @@
|
|
23 |
*/
|
24 |
|
25 |
if ($this->canShowButton()):
|
26 |
-
if ($
|
27 |
//$lmhelper = Mage::helper('litemage/data');
|
28 |
?>
|
29 |
<br/>
|
30 |
|
31 |
<div class="entry-edit"><ul class="messages">
|
32 |
<li class="notice-msg">
|
33 |
-
<form action="<?php echo $
|
34 |
<?php echo $this->getBlockHtml('formkey')?>
|
35 |
LiteMage Cache: Clicking the Save Button Will Automatically Purge Cache
|
36 |
-
<select name="
|
37 |
<?php echo $this->getCurrentProdSaveOptions(); ?>
|
38 |
</select>
|
39 |
<div class="form-buttons">
|
23 |
*/
|
24 |
|
25 |
if ($this->canShowButton()):
|
26 |
+
if ($prodsaveurl = $this->getProductSaveOptionUrl()) :
|
27 |
//$lmhelper = Mage::helper('litemage/data');
|
28 |
?>
|
29 |
<br/>
|
30 |
|
31 |
<div class="entry-edit"><ul class="messages">
|
32 |
<li class="notice-msg">
|
33 |
+
<form action="<?php echo $prodsaveurl;?>" method="post" id="litemage_prodsave">
|
34 |
<?php echo $this->getBlockHtml('formkey')?>
|
35 |
LiteMage Cache: Clicking the Save Button Will Automatically Purge Cache
|
36 |
+
<select name="litemage_prodpurgeoption" onchange="submit()">
|
37 |
<?php echo $this->getCurrentProdSaveOptions(); ?>
|
38 |
</select>
|
39 |
<div class="form-buttons">
|
package.xml
CHANGED
@@ -1,18 +1,21 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>LiteSpeed_LiteMage</name>
|
4 |
-
<version>1.2.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://opensource.org/licenses/GPL-3.0 ">GPL v3</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>LiteMage Cache speeds up Magento by automatically integrating Magento with LiteSpeed's superior ESI implementation.</summary>
|
10 |
<description>LiteMage Cache is a powerful Magento page caching utility built into LiteSpeed Web Server. It combines superior ESI implementation with easy set up. LiteMage Cache contains a number of optimizations, including combined subrequests, that give it faster, more efficient performance than other page caching utilities. In addition, because it is part of the web server, LiteMage Cache does away with the communication problems and overhead other page caching solutions suffer from. The LiteMage Magento extension then automatically integrates Magento installations with LiteSpeed's top-of-the-line ESI implementation, combining the greatest Magento performance enhancement possible with a painless set up.</description>
|
11 |
-
<notes>
|
|
|
|
|
|
|
12 |
<authors><author><name>LiteSpeed Technologies</name><user>LiteSpeedTech</user><email>lsong@litespeedtech.com</email></author></authors>
|
13 |
-
<date>2016-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="Litespeed"><dir name="Litemage"><dir name="Block"><dir name="Adminhtml"><dir name="Cache"><file name="Management.php" hash="126c636bebf6a1933f45781d6e95863d"/></dir><file name="ItemSave.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.0</min><max>7.1.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>LiteSpeed_LiteMage</name>
|
4 |
+
<version>1.2.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://opensource.org/licenses/GPL-3.0 ">GPL v3</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>LiteMage Cache speeds up Magento by automatically integrating Magento with LiteSpeed's superior ESI implementation.</summary>
|
10 |
<description>LiteMage Cache is a powerful Magento page caching utility built into LiteSpeed Web Server. It combines superior ESI implementation with easy set up. LiteMage Cache contains a number of optimizations, including combined subrequests, that give it faster, more efficient performance than other page caching utilities. In addition, because it is part of the web server, LiteMage Cache does away with the communication problems and overhead other page caching solutions suffer from. The LiteMage Magento extension then automatically integrates Magento installations with LiteSpeed's top-of-the-line ESI implementation, combining the greatest Magento performance enhancement possible with a painless set up.</description>
|
11 |
+
<notes>Added a category purge option on the Edit Category screen.
|
12 |
+
Fixed a bug that was introduced in 1.2.0 that affected crawling urls with a cache vary.
|
13 |
+
Fixed a bug where the crawler sometimes did not work properly when setting the LiteMage Server IP.
|
14 |
+
Fixed a bug that occurred when user agent theme exceptions were added for the template and skin, but not added for the layout.</notes>
|
15 |
<authors><author><name>LiteSpeed Technologies</name><user>LiteSpeedTech</user><email>lsong@litespeedtech.com</email></author></authors>
|
16 |
+
<date>2016-10-03</date>
|
17 |
+
<time>19:30:53</time>
|
18 |
+
<contents><target name="magecommunity"><dir name="Litespeed"><dir name="Litemage"><dir name="Block"><dir name="Adminhtml"><dir name="Cache"><file name="Management.php" hash="126c636bebf6a1933f45781d6e95863d"/></dir><file name="ItemSave.php" hash="399a23c090fd92436793b1e0e38038a1"/></dir><dir name="Core"><file name="Dummy.php" hash="ae50751905056dd3eb34c3222d17a310"/><file name="Esi.php" hash="32da90253e38aedf67a8c4619bfc983b"/><file name="Messages.php" hash="da581eb4adaa1ac4e2d4b86ff30f08d4"/><file name="Xml.php" hash="6c7d088368f06151be14609dde9afade"/></dir><dir name="Inject"><file name="Jsvar.php" hash="cc0590fe211c81d6d29de570503fe8fd"/><file name="Nickname.php" hash="deba1efffd6449b6492bb13aaca4658b"/></dir></dir><dir name="Helper"><file name="Data.php" hash="ea4515e65dfdfd216bd4f17b80a93092"/><file name="Esi.php" hash="a9cde1e756ad90b492fae9761632e099"/><file name="Viewvary.php" hash="04f39f2d726a3c92f83ff53abdf4cffe"/></dir><dir name="Model"><dir name="Config"><dir name="Backend"><file name="WarmUp.php" hash="663ecf7689115059eb94898f37adeb6f"/></dir><dir name="Source"><file name="CustomerGroup.php" hash="2aa52d9a1614a545035267958be0656f"/><file name="EnableDebugLog.php" hash="27d4b6030f564dfae8c89a84264b1175"/><file name="EnableWarmUp.php" hash="f44aafa2f6ba65a0e4926b7635ff264d"/><file name="FlushCategory.php" hash="b8017a1859b320f05af272f4d4e442e2"/></dir></dir><file name="EsiData.php" hash="98b1ce4bf07d2b795e1efeb5f5b030a9"/><file name="EsiLayout.php" hash="26bef4ee2a873ecb26ba7f292cfe0fd6"/><dir name="Layout"><file name="EsiUpdate.php" hash="3c98a2961b08f0acb3d334ab932eb397"/><file name="Master.php" hash="5eb57ba3677b76468ccf6f74741dcc63"/><file name="Update.php" hash="a72d4beb502803532af5d1ac2a06a06e"/></dir><dir name="Observer"><file name="Cron.php" hash="f41d47e2645d5c6d3dfb954aab21bc2c"/><file name="Esi.php" hash="5807fde7b90682552ddca957a4c6f7e8"/><file name="Purge.php" hash="d46bbebcf3ebe0dded284c9666b44406"/></dir><file name="Session.php" hash="558a80fb45a532af59727ae5657cd380"/><file name="Translate.php" hash="35326b8d2214f516d7dba82519902529"/></dir><dir name="controllers"><file name="AdminController.php" hash="549098ba10e19b066a6d52eab0f7bbb6"/><dir name="Adminhtml"><file name="LitemageCacheController.php" hash="506c63ddec598d39fa8a1dd1e58549d9"/></dir><file name="EsiController.php" hash="7e9fddc9ea18f9536e5d97f299c3f3d2"/></dir><dir name="etc"><file name="config.xml" hash="35c29d09152df7e21d90f33db6b0791b"/><file name="system.xml" hash="1e9b07d6e095634897c1993e0db42495"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="litemage.xml" hash="f4dd1848120e353da9a84a7fd5565093"/></dir><dir name="template"><dir name="litemage"><file name="cache_management.phtml" hash="64c252b79223fe85a071fa9806939575"/><file name="category_save.phtml" hash="b29d102b8f90ce4da881a30efa3b2838"/><file name="product_save.phtml" hash="01863cb9acd33ca51db4f2a26e233eec"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="litemage.xml" hash="4c840b12cc6246f68b1b028f0ef1056d"/></dir><dir name="template"><dir name="litemage"><dir name="inject"><file name="jsvar.phtml" hash="5bbd9992e7ba5925d09f21cf03237676"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Litespeed_Litemage.xml" hash="ba0c8904bc89219c6829e37cc14d9bdd"/></dir></target><target name="mage"><dir name="shell"><file name="litemage_purge.php" hash="fbcc05832098dfbda5d30bfe24973fab"/></dir></target></contents>
|
19 |
<compatible/>
|
20 |
<dependencies><required><php><min>5.3.0</min><max>7.1.0</max></php></required></dependencies>
|
21 |
</package>
|