Index: branches/5.2.x/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r15418 -r15421 --- branches/5.2.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 15418) +++ branches/5.2.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 15421) @@ -1,6 +1,6 @@ Application->GetVar('continue'); - $total_cats = (int) $this->Conn->GetOne('SELECT COUNT(*) FROM '.TABLE_PREFIX.'Categories'); + $total_cats = (int)$this->Conn->GetOne('SELECT COUNT(*) FROM ' . TABLE_PREFIX . 'Categories'); - if ($continue === false && $total_cats > CACHE_PERM_CHUNK_SIZE) { - // first step, if category count > CACHE_PERM_CHUNK_SIZE, then ask for cache update - return true; - } + if ( $continue === false ) { + $rebuild_mode = $this->Application->ConfigValue('CategoryPermissionRebuildMode'); - if ($continue === false) { + if ( $rebuild_mode == CategoryPermissionRebuild::AUTOMATIC && $total_cats > CACHE_PERM_CHUNK_SIZE ) { + // first step, if category count > CACHE_PERM_CHUNK_SIZE, then ask for cache update + return true; + } + // if we don't have to ask, then assume user selected "Yes" in permcache update dialog $continue = 1; } - $updater = $this->Application->makeClass('kPermCacheUpdater', Array($continue)); + $updater = $this->Application->makeClass('kPermCacheUpdater', Array ($continue)); /* @var $updater kPermCacheUpdater */ - if ($continue === '0') { // No in dialog + if ( $continue === '0' ) { // No in dialog $updater->clearData(); $this->Application->Redirect($params['destination_template']); } $ret = false; // don't ask for update - if ($continue == 1) { // Initial run + + if ( $continue == 1 ) { // Initial run $updater->setData(); } - if ($continue == 2) { // Continuing + + if ( $continue == 2 ) { // Continuing // called 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 + + while ( $needs_more && $updater->iteration <= CACHE_PERM_CHUNK_SIZE ) { + // until proceeded in this step category count exceeds category per step limit $needs_more = $updater->DoTheJob(); } - if ($needs_more) { + if ( $needs_more ) { // still some categories are left for next step $updater->setData(); } @@ -560,6 +565,7 @@ $ret = $updater->getDonePercent(); } + return $ret; }