Index: branches/5.2.x/core/units/categories/cache_updater.php =================================================================== diff -u -N -r14092 -r14095 --- branches/5.2.x/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 14092) +++ branches/5.2.x/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 14095) @@ -1,6 +1,6 @@ StrictPath = isset($event_params['strict_path']) ? $event_params['strict_path'] : false; - if ($this->StrictPath && !is_array($this->StrictPath)) { - $this->StrictPath = explode('|', trim($this->StrictPath, '|')); + if ( isset($strict_path) ) { + if ( $strict_path && !is_array($strict_path) ) { + $strict_path = explode('|', trim($strict_path, '|')); + } + + $this->StrictPath = $strict_path; } - // cache widely used values to speed up process: begin + // cache widely used values to speed up process $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); /* @var $ml_helper kMultiLanguageHelper */ - $this->languageCount = $ml_helper->getLanguageCount(); + $this->languages = $ml_helper->getLanguages(); $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']; @@ -220,34 +229,14 @@ $this->progressTable = $this->Application->GetTempName('permCacheUpdate'); $this->permCacheTable = $this->Application->GetTempName(TABLE_PREFIX.'PermCache'); - if ($continuing == 1) { + if (!isset($continuing) || $continuing == 1) { $this->InitUpdater(); } elseif ($continuing == 2) { $this->getData(); } } - /** - * Checks if language with specified id is created - * - * @param int $language_id - * @return bool - */ - function LanguageFound($language_id) - { - static $language_ids = null; - - if (!isset($language_ids)) { - $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); - /* @var $ml_helper kMultiLanguageHelper */ - - $language_ids = $ml_helper->languagesIDs; - } - - return in_array($language_id, $language_ids) || $language_id <= 5; - } - function InitUpdater() { $this->Stack = new clsRecursionStack(); @@ -397,10 +386,7 @@ $next_data['template'] = $data['template']; $next_data['item_template'] = $data['item_template']; $next_data['current_id'] = $data['children'][ $data['current_child'] ]; //next iteration should process child - - // TODO: use "clone" when on PHP5 - $next_data['perms'] = unserialize( serialize($data['perms']) ); // we should copy our permissions to child - inheritance - + $next_data['perms'] = clone $data['perms']; // copy permissions to child - inheritance $next_data['perms']->SetCatId($next_data['current_id']); $next_data['left'] = $data['right']; $data['current_child']++; @@ -444,14 +430,8 @@ 'TreeRight' => $data['right'], ); - $i = 1; - while ($i <= $this->languageCount) { - if (!$this->LanguageFound($i)) { - $i++; - continue; - } - $fields_hash['l'.$i.'_CachedNavbar'] = implode('&|&', $data['titles'][$i]); - $i++; + foreach ($this->languages as $language_id) { + $fields_hash['l'.$language_id.'_CachedNavbar'] = implode('&|&', $data['titles'][$language_id]); } $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$data['current_id']); @@ -470,11 +450,11 @@ $record = $this->Conn->GetRow($sql); if ($record) { - $i = 1; - while ($i <= $this->languageCount) { - $data['titles'][$i][] = $record['l'.$i.'_Name'] ? $record['l'.$i.'_Name'] : $record['l'.$this->primaryLanguageId.'_Name']; - $i++; + + foreach ($this->languages as $language_id) { + $data['titles'][$language_id][] = $record['l'.$language_id.'_Name'] ? $record['l'.$language_id.'_Name'] : $record['l'.$this->primaryLanguageId.'_Name']; } + $data['debug_title'] = $record['l1_Name']; $data['parent_path'][] = $category_id;