Index: branches/5.2.x/core/units/helpers/multilanguage_helper.php =================================================================== diff -u -N -r15111 -r15327 --- branches/5.2.x/core/units/helpers/multilanguage_helper.php (.../multilanguage_helper.php) (revision 15111) +++ branches/5.2.x/core/units/helpers/multilanguage_helper.php (.../multilanguage_helper.php) (revision 15327) @@ -1,6 +1,6 @@ initMade = false; + } + /** * Updates language count in system (always is divisible by 5) * */ - protected function initLanguageCount() + protected function _queryLanguages() { - static $init_made = false; - - if (!$init_made) { + if ( !$this->initMade ) { $this->languagesIDs = $this->getActualLanguages(); - $this->languageCount = max( max($this->languagesIDs), 5 ); - $init_made = true; + $this->languageCount = max(max($this->languagesIDs), 5); + $this->initMade = true; } } @@ -83,10 +94,10 @@ */ protected function getActualLanguages() { - $cache_key = 'language_ids[%LangSerial%]'; + $cache_key = 'actual_language_ids[%LangSerial%]'; $ret = $this->Application->getCache($cache_key); - if ($ret === false) { + if ( $ret === false ) { $this->Conn->nextQueryCachable = true; $sql = 'SELECT ' . $this->Application->getUnitOption('lang', 'IDField') . ' FROM ' . $this->Application->getUnitOption('lang', 'TableName'); @@ -116,20 +127,23 @@ */ public function getLanguages() { - static $languages = null; + $cache_key = 'processable_language_ids[%LangSerial%]'; + $ret = $this->Application->getCache($cache_key); - if ( !isset($languages) ) { - $languages = Array (); - $this->initLanguageCount(); + if ( $ret === false ) { + $ret = Array (); + $this->_queryLanguages(); for ($language_id = 1; $language_id <= $this->languageCount; $language_id++) { if ( $this->LanguageFound($language_id) ) { - $languages[] = $language_id; + $ret[] = $language_id; } } + + $this->Application->setCache($cache_key, $ret); } - return $languages; + return $ret; } function scanTable($mask) @@ -195,7 +209,7 @@ return ; } - $this->initLanguageCount(); + $this->_queryLanguages(); $sqls = Array (); $this->readTableStructure($table_name, $refresh);