Index: branches/5.1.x/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r13159 -r13168 --- branches/5.1.x/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 13159) +++ branches/5.1.x/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 13168) @@ -1,6 +1,6 @@ Application->getUnitOption($this->Prefix, 'CacheModRewrite') && $this->Application->RewriteURLs(); + $cache_mod_rw = $this->Application->getUnitOption($this->Prefix, 'CacheModRewrite') && + $this->Application->RewriteURLs() && !$this->Application->isCachingType(CACHING_TYPE_MEMORY); + $limit = isset($params['limit']) ? $params['limit'] : false; - while (!$list->EOL() && (!$limit || $i<$limit)) - { + while (!$list->EOL() && (!$limit || $i<$limit)) { $this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) ); // for edit/delete links using GET $this->Application->SetVar( $this->Prefix.'_id', $list->GetDBField($id_field) ); $block_params['is_last'] = ($i == $list->SelectedCount - 1); $block_params['last_row'] = ($i + (($i+1) % $columns) >= $list->SelectedCount - 1); $block_params['not_last'] = !$block_params['is_last']; // for front-end if ($cache_mod_rw) { + $serial_name = $this->Application->incrementCacheSerial($this->Prefix, $list->GetDBField($id_field), false); + if ($this->Prefix == 'c') { // for listing subcategories in category - $this->Application->setCache('filenames', $this->Prefix.'_'.$list->GetDBField($id_field), $list->GetDBField('NamedParentPath')); - $this->Application->setCache('category_tree', $list->GetDBField($id_field), $list->GetDBField('TreeLeft') . ';' . $list->GetDBField('TreeRight')); + $this->Application->setCache('filenames[%' . $serial_name . '%]' , $list->GetDBField('NamedParentPath')); + $this->Application->setCache('category_tree[%CIDSerial:' . $list->GetDBField($id_field) . '%]', $list->GetDBField('TreeLeft') . ';' . $list->GetDBField('TreeRight')); } else { // for listing items in category - $this->Application->setCache('filenames', 'c_'.$list->GetDBField('CategoryId'), $list->GetDBField('CategoryFilename')); - $this->Application->setCache('filenames', $this->Prefix.'_'.$list->GetDBField($id_field), $list->GetDBField('Filename')); + $this->Application->setCache('filenames[%' . $serial_name . '%]', $list->GetDBField('Filename')); + + $serial_name = $this->Application->incrementCacheSerial('c', $list->GetDBField('CategoryId'), false); + $this->Application->setCache('filenames[%' . $serial_name . '%]', $list->GetDBField('CategoryFilename')); } } @@ -782,18 +787,23 @@ function AddCurrencySymbol($value, $iso) { - $currency =& $this->Application->recallObject('curr.-'.$iso, null, Array('skip_autoload' => true)); - if( !$currency->isLoaded() ) $currency->Load($iso, 'ISO'); + $cache_key = 'iso_masks[%CurrSerial%]'; + $iso_masks = $this->Application->getCache($cache_key); - $symbol = $currency->GetDBField('Symbol'); - if (!$symbol) $symbol = $currency->GetDBField('ISO').' '; - if ($currency->GetDBField('SymbolPosition') == 0) { - $value = $symbol.$value; + if ($iso_masks === false) { + $this->Conn->nextQueryCachable = true; + $symbol_sql = 'IF(COALESCE(Symbol, "") = "", CONCAT(ISO, " "), Symbol)'; + + $sql = 'SELECT IF(SymbolPosition = 0, CONCAT(' . $symbol_sql . ', "%s"), CONCAT("%s", ' . $symbol_sql . ')), LOWER(ISO) AS ISO + FROM ' . $this->Application->getUnitOption('curr', 'TableName') . ' + WHERE Status = ' . STATUS_ACTIVE; + $iso_masks = $this->Conn->GetCol($sql, 'ISO'); + $this->Application->setCache($cache_key, $iso_masks); } - if ($currency->GetDBField('SymbolPosition') == 1) { - $value = $value.$symbol; - } - return $value; + + $iso = strtolower($iso); + + return array_key_exists($iso, $iso_masks) ? sprintf($iso_masks[$iso], $value) : $value; } /** @@ -2562,7 +2572,7 @@ if (!array_key_exists($check_field, $fields)) { // field not found in real fields array -> it's 100% virtual then - $fields = $this->Application->getUnitOption($this->Prefix, 'VirtualFields'); + $fields = $this->Application->getUnitOption($this->Prefix, 'VirtualFields', Array ()); } if (!array_key_exists($check_field, $fields)) {