Index: branches/unlabeled/unlabeled-1.28.2/kernel/units/categories/categories_tag_processor.php =================================================================== diff -u -r5883 -r5887 --- branches/unlabeled/unlabeled-1.28.2/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5883) +++ branches/unlabeled/unlabeled-1.28.2/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5887) @@ -341,7 +341,7 @@ if ($continue == 2) { // Continuing // called from AJAX request => returns percent $needs_more = true; - while ($needs_more && $updater->iteration < CACHE_PERM_CHUNK_SIZE) { + 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(); } Index: branches/unlabeled/unlabeled-1.28.2/core/units/categories/categories_tag_processor.php =================================================================== diff -u -r5883 -r5887 --- branches/unlabeled/unlabeled-1.28.2/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5883) +++ branches/unlabeled/unlabeled-1.28.2/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5887) @@ -341,7 +341,7 @@ if ($continue == 2) { // Continuing // called from AJAX request => returns percent $needs_more = true; - while ($needs_more && $updater->iteration < CACHE_PERM_CHUNK_SIZE) { + 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(); } Index: branches/unlabeled/unlabeled-1.155.2/core/kernel/application.php =================================================================== diff -u -r5795 -r5887 --- branches/unlabeled/unlabeled-1.155.2/core/kernel/application.php (.../application.php) (revision 5795) +++ branches/unlabeled/unlabeled-1.155.2/core/kernel/application.php (.../application.php) (revision 5887) @@ -728,7 +728,7 @@ */ function UseOutputCompression() { - if (constOn('IS_INSTALL')) return false; + if (constOn('IS_INSTALL') || constOn('DBG_ZEND_PRESENT')) return false; return $this->ConfigValue('UseOutputCompression') && function_exists('gzencode') && strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'); } @@ -1097,12 +1097,12 @@ function getPassThroughVariables(&$params) { static $cached_pass_through = null; - + if (isset($params['no_pass_through']) && $params['no_pass_through']) { unset($params['no_pass_through']); return Array(); } - + // because pass through is not changed during script run, then we can cache it if (is_null($cached_pass_through)) { Index: branches/unlabeled/unlabeled-1.6.2/core/units/categories/cache_updater.php =================================================================== diff -u -r5651 -r5887 --- branches/unlabeled/unlabeled-1.6.2/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 5651) +++ branches/unlabeled/unlabeled-1.6.2/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 5887) @@ -139,23 +139,23 @@ var $primaryLanguageId = 0; var $languageCount = 0; var $root_prefixes = Array(); - + function Init($prefix, $special, $event_params = null) { parent::Init($prefix, $special, $event_params); - + $continuing = $event_params['continue']; - + // cache widely used values to speed up process: begin $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); $this->languageCount = $ml_helper->getLanguageCount(); $this->primaryLanguageId = $this->Application->GetDefaultLanguageId(); // cache widely used values to speed up process: end - + foreach ($this->Application->ModuleInfo as $module_name => $module_info) { $this->root_prefixes[ $module_info['RootCat'] ] = $module_info['Var']; } - + $this->iteration = 0; $this->table = $this->Application->GetTempName('permCacheUpdate'); @@ -166,21 +166,21 @@ $this->getData(); } } - + function InitUpdater() { $this->Stack =& new clsRecursionStack(); $sql = 'DELETE FROM '.TABLE_PREFIX.'PermCache'; $this->Conn->Query($sql); $this->initData(); } - + function getDonePercent() { if(!$this->totalCats)return 0; - return intval( round( $this->doneCats / $this->totalCats * 100 ) ); + return min(100, intval( round( $this->doneCats / $this->totalCats * 100 ) )); } - + function getData() { $tmp = $this->Conn->GetOne('SELECT data FROM '.$this->table); @@ -195,31 +195,31 @@ $this->Stack = & new clsRecursionStack(); } } - + function setData() { $tmp = Array ( 'totalCats' => $this->totalCats, 'doneCats' => $this->doneCats, 'stack' => $this->Stack, ); - + $this->Conn->Query('DELETE FROM '.$this->table); - + $fields_hash = Array('data' => serialize($tmp)); $this->Conn->doInsert($fields_hash, $this->table); } - + function initData() { $this->clearData(); // drop table before starting anyway - + $this->Conn->Query('CREATE TABLE '.$this->table.'(data LONGTEXT)'); $this->totalCats = (int)$this->Conn->GetOne('SELECT COUNT(*) FROM '.TABLE_PREFIX.'Category'); $this->doneCats = 0; } - + function clearData() { $this->Conn->Query('DROP TABLE IF EXISTS '.$this->table); @@ -246,7 +246,7 @@ if ($sql = $data['perms']->GetInsertSQL()) { $this->Conn->Query($sql); - $this->doneCats++; + // $this->doneCats++; // moved to the place where it pops out of the stack by Kostja } $this->iteration++; } @@ -274,25 +274,27 @@ $this->UpdateCachedPath($data); $this->Stack->Pop(); //remove ourself from stack if we have finished all the childs (or there are none) // we are getting here if we finished with current level, so check if it's first level - then bail out. + + $this->doneCats++; // moved by Kostja from above, seems to fix the prob return $this->Stack->Count() > 0; } } - + function UpdateCachedPath(&$data) { - $fields_hash = Array ( + $fields_hash = Array ( 'ParentPath' => '|'.implode('|', $data['parent_path']).'|', 'NamedParentPath' => implode('/', $data['named_path'] ), 'CachedCategoryTemplate' => $data['category_template'], 'CachedItemTemplate' => $data['item_template'], ); - + $i = 1; while ($i <= $this->languageCount) { $fields_hash['l'.$i.'_CachedNavbar'] = implode('&|&', $data['titles'][$i]); $i++; } - + $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$data['current_id']); } @@ -310,10 +312,10 @@ $data['titles'][$i][] = $record['l'.$i.'_Name'] ? $record['l'.$i.'_Name'] : $record['l'.$this->primaryLanguageId.'_Name']; $i++; } - + $data['parent_path'][] = $category_id; $data['named_path'][] = $record['Filename']; - + // it is one of the modules root category $root_prefix = isset($this->root_prefixes[$category_id]) ? $this->root_prefixes[$category_id] : false; if ($root_prefix) { @@ -322,25 +324,25 @@ $record['CategoryTemplate'] = $this->Application->ConfigValue($root_prefix.'_CategoryTemplate'); $fields_hash['CategoryTemplate'] = $record['CategoryTemplate']; } - + if (!$record['ItemTemplate']) { $record['ItemTemplate'] = $this->Application->ConfigValue($root_prefix.'_ItemTemplate'); $fields_hash['ItemTemplate'] = $record['ItemTemplate']; } - + $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$category_id); } - + // if explicitly set, then use it; use parent template otherwise if ($record['CategoryTemplate']) { $data['category_template'] = $record['CategoryTemplate']; } - + if ($record['ItemTemplate']) { $data['item_template'] = $record['ItemTemplate']; } } - + } function QueryChildren(&$data) @@ -359,7 +361,7 @@ LEFT JOIN '.TABLE_PREFIX.'PermissionConfig AS ipc ON ipc.PermissionName = ip.Permission WHERE (CatId = '.$data['current_id'].') AND (Permission LIKE "%.VIEW") AND (ip.Type = 0)'; - $records = $this->Conn->Query($sql); + $records = $this->Conn->Query($sql); //create permissions array only if we don't have it yet (set by parent) if (!isset($data['perms'])) { Index: branches/unlabeled/unlabeled-1.6.2/kernel/units/categories/cache_updater.php =================================================================== diff -u -r5651 -r5887 --- branches/unlabeled/unlabeled-1.6.2/kernel/units/categories/cache_updater.php (.../cache_updater.php) (revision 5651) +++ branches/unlabeled/unlabeled-1.6.2/kernel/units/categories/cache_updater.php (.../cache_updater.php) (revision 5887) @@ -139,23 +139,23 @@ var $primaryLanguageId = 0; var $languageCount = 0; var $root_prefixes = Array(); - + function Init($prefix, $special, $event_params = null) { parent::Init($prefix, $special, $event_params); - + $continuing = $event_params['continue']; - + // cache widely used values to speed up process: begin $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); $this->languageCount = $ml_helper->getLanguageCount(); $this->primaryLanguageId = $this->Application->GetDefaultLanguageId(); // cache widely used values to speed up process: end - + foreach ($this->Application->ModuleInfo as $module_name => $module_info) { $this->root_prefixes[ $module_info['RootCat'] ] = $module_info['Var']; } - + $this->iteration = 0; $this->table = $this->Application->GetTempName('permCacheUpdate'); @@ -166,21 +166,21 @@ $this->getData(); } } - + function InitUpdater() { $this->Stack =& new clsRecursionStack(); $sql = 'DELETE FROM '.TABLE_PREFIX.'PermCache'; $this->Conn->Query($sql); $this->initData(); } - + function getDonePercent() { if(!$this->totalCats)return 0; - return intval( round( $this->doneCats / $this->totalCats * 100 ) ); + return min(100, intval( round( $this->doneCats / $this->totalCats * 100 ) )); } - + function getData() { $tmp = $this->Conn->GetOne('SELECT data FROM '.$this->table); @@ -195,31 +195,31 @@ $this->Stack = & new clsRecursionStack(); } } - + function setData() { $tmp = Array ( 'totalCats' => $this->totalCats, 'doneCats' => $this->doneCats, 'stack' => $this->Stack, ); - + $this->Conn->Query('DELETE FROM '.$this->table); - + $fields_hash = Array('data' => serialize($tmp)); $this->Conn->doInsert($fields_hash, $this->table); } - + function initData() { $this->clearData(); // drop table before starting anyway - + $this->Conn->Query('CREATE TABLE '.$this->table.'(data LONGTEXT)'); $this->totalCats = (int)$this->Conn->GetOne('SELECT COUNT(*) FROM '.TABLE_PREFIX.'Category'); $this->doneCats = 0; } - + function clearData() { $this->Conn->Query('DROP TABLE IF EXISTS '.$this->table); @@ -246,7 +246,7 @@ if ($sql = $data['perms']->GetInsertSQL()) { $this->Conn->Query($sql); - $this->doneCats++; + // $this->doneCats++; // moved to the place where it pops out of the stack by Kostja } $this->iteration++; } @@ -274,25 +274,27 @@ $this->UpdateCachedPath($data); $this->Stack->Pop(); //remove ourself from stack if we have finished all the childs (or there are none) // we are getting here if we finished with current level, so check if it's first level - then bail out. + + $this->doneCats++; // moved by Kostja from above, seems to fix the prob return $this->Stack->Count() > 0; } } - + function UpdateCachedPath(&$data) { - $fields_hash = Array ( + $fields_hash = Array ( 'ParentPath' => '|'.implode('|', $data['parent_path']).'|', 'NamedParentPath' => implode('/', $data['named_path'] ), 'CachedCategoryTemplate' => $data['category_template'], 'CachedItemTemplate' => $data['item_template'], ); - + $i = 1; while ($i <= $this->languageCount) { $fields_hash['l'.$i.'_CachedNavbar'] = implode('&|&', $data['titles'][$i]); $i++; } - + $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$data['current_id']); } @@ -310,10 +312,10 @@ $data['titles'][$i][] = $record['l'.$i.'_Name'] ? $record['l'.$i.'_Name'] : $record['l'.$this->primaryLanguageId.'_Name']; $i++; } - + $data['parent_path'][] = $category_id; $data['named_path'][] = $record['Filename']; - + // it is one of the modules root category $root_prefix = isset($this->root_prefixes[$category_id]) ? $this->root_prefixes[$category_id] : false; if ($root_prefix) { @@ -322,25 +324,25 @@ $record['CategoryTemplate'] = $this->Application->ConfigValue($root_prefix.'_CategoryTemplate'); $fields_hash['CategoryTemplate'] = $record['CategoryTemplate']; } - + if (!$record['ItemTemplate']) { $record['ItemTemplate'] = $this->Application->ConfigValue($root_prefix.'_ItemTemplate'); $fields_hash['ItemTemplate'] = $record['ItemTemplate']; } - + $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$category_id); } - + // if explicitly set, then use it; use parent template otherwise if ($record['CategoryTemplate']) { $data['category_template'] = $record['CategoryTemplate']; } - + if ($record['ItemTemplate']) { $data['item_template'] = $record['ItemTemplate']; } } - + } function QueryChildren(&$data) @@ -359,7 +361,7 @@ LEFT JOIN '.TABLE_PREFIX.'PermissionConfig AS ipc ON ipc.PermissionName = ip.Permission WHERE (CatId = '.$data['current_id'].') AND (Permission LIKE "%.VIEW") AND (ip.Type = 0)'; - $records = $this->Conn->Query($sql); + $records = $this->Conn->Query($sql); //create permissions array only if we don't have it yet (set by parent) if (!isset($data['perms'])) {