Index: branches/unlabeled/unlabeled-1.6.2/core/units/categories/cache_updater.php =================================================================== diff -u -N -r5631 -r5635 --- branches/unlabeled/unlabeled-1.6.2/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 5631) +++ branches/unlabeled/unlabeled-1.6.2/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 5635) @@ -136,18 +136,22 @@ var $doneCats; var $table; + var $primaryLanguageId = 0; + var $languageCount = 0; var $root_prefixes = Array(); - var $TitleField = ''; function Init($prefix, $special, $event_params = null) { parent::Init($prefix, $special, $event_params); - $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); - $this->TitleField = $ml_formatter->LangFieldName('Name'); - $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']; } @@ -226,7 +230,7 @@ $data = $this->Stack->Get(); if ($data === false) { //If Stack is empty $data['current_id'] = 0; - $data['title'] = Array(); + $data['titles'] = Array(); $data['parent_path'] = Array(); $data['named_path'] = Array(); $data['category_template'] = ''; @@ -253,7 +257,7 @@ // if we have more children if (isset($data['children'][$data['current_child']])) { $next_data = Array(); - $next_data['title'] = $data['title']; + $next_data['titles'] = $data['titles']; $next_data['parent_path'] = $data['parent_path']; $next_data['named_path'] = $data['named_path']; $next_data['category_template'] = $data['category_template']; @@ -276,26 +280,37 @@ function UpdateCachedPath(&$data) { - $fields_hash = Array( 'CachedNavbar' => implode('>', $data['title']), - 'ParentPath' => '|'.implode('|', $data['parent_path']).'|', - 'NamedParentPath' => implode('/', $data['named_path'] ), - 'CachedCategoryTemplate'=> $data['category_template'], - 'CachedItemTemplate' => $data['item_template'], + $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']); } function QueryTitle(&$data) { $category_id = $data['current_id']; - $sql = 'SELECT '.$this->TitleField.', Filename, CategoryTemplate, ItemTemplate + $sql = 'SELECT * FROM '.TABLE_PREFIX.'Category WHERE CategoryId = '.$category_id; $record = $this->Conn->GetRow($sql); if ($record) { - $data['title'][] = $record[$this->TitleField]; + $i = 1; + while ($i <= $this->languageCount) { + $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'];