Index: trunk/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r5036 -r5164 --- trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5036) +++ trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5164) @@ -321,6 +321,54 @@ } return $parent_id; } + + function InitCacheUpdater($params) + { + safeDefine('CACHE_PERM_CHUNK_SIZE', 30); + + $force = $this->Application->GetVar('force'); + $continue = $this->Application->GetVar('continue'); + + $updater =& $this->Application->recallObject('kPermCacheUpdater', null, Array('continue' => $continue)); + + $ret = false; // don't ask for update + if ($continue !== false) { + if ($continue == 1) { + if ($this->Application->GetVar('ajax')) { + // call from AJAX request => returns percent + $needs_more = true; + while ($needs_more && $updater->iteration < CACHE_PERM_CHUNK_SIZE) { + // until proceeeded in this step category count exceeds category per step limit + $needs_more = $updater->DoTheJob(); + } + + if ($needs_more) { + // still some categories are left for next step + $updater->setData(); + } + else { + $updater->clearData(); + $this->Application->StoreVar('PermCache_UpdateRequired', 0); + $this->Application->Redirect($params['destination_template']); + } + + $ret = $updater->getDonePercent(); + } + } + else { + // user selected "No" in perm cache update dialog + $updater->clearData(); + $this->Application->Redirect($params['destination_template']); + } + + } + elseif (!$force && ($updater->totalCats > CACHE_PERM_CHUNK_SIZE)) { + // ask before doing anything + $updater->setData(); + $ret = true; + } + return $ret; + } }