Index: branches/5.2.x/core/units/categories/cache_updater.php =================================================================== diff -u -N -r14699 -r15012 --- branches/5.2.x/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 14699) +++ branches/5.2.x/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 15012) @@ -1,6 +1,6 @@ iteration = 0; $this->progressTable = $this->Application->GetTempName('permCacheUpdate'); - $this->permCacheTable = $this->Application->GetTempName(TABLE_PREFIX.'PermCache'); + $this->permCacheTable = $this->Application->GetTempName(TABLE_PREFIX.'CategoryPermissionsCache'); if (!isset($continuing) || $continuing == 1) { $this->InitUpdater(); @@ -285,13 +285,13 @@ $this->clearData(); // drop table before starting anyway // 1. create table for rebuilding permissions cache - $this->Conn->Query('CREATE TABLE '.$this->permCacheTable.' LIKE '.TABLE_PREFIX.'PermCache'); + $this->Conn->Query('CREATE TABLE '.$this->permCacheTable.' LIKE '.TABLE_PREFIX.'CategoryPermissionsCache'); if ($this->StrictPath) { // when using strict path leave all other cache intact $sql = 'INSERT INTO '.$this->permCacheTable.' SELECT * - FROM '.TABLE_PREFIX.'PermCache'; + FROM '.TABLE_PREFIX.'CategoryPermissionsCache'; $this->Conn->Query($sql); // delete only cache related to categories in path @@ -305,14 +305,17 @@ $this->Conn->Query('CREATE TABLE '.$this->progressTable.'(data LONGTEXT'.$add_charset.$add_collation.') '.$add_charset.$add_collation); - $this->totalCats = (int)$this->Conn->GetOne('SELECT COUNT(*) FROM '.TABLE_PREFIX.'Category'); + $this->totalCats = (int)$this->Conn->GetOne('SELECT COUNT(*) FROM '.TABLE_PREFIX.'Categories'); $this->doneCats = 0; } function clearData() { // some templates use this - $this->Conn->Query('UPDATE '.TABLE_PREFIX.'ConfigurationValues SET VariableValue = VariableValue+1 WHERE VariableName = \'CategoriesRebuildSerial\''); + $sql = 'UPDATE ' . TABLE_PREFIX . 'SystemSettings + SET VariableValue = VariableValue + 1 + WHERE VariableName = "CategoriesRebuildSerial"'; + $this->Conn->Query($sql); // always drop temporary tables $this->Conn->Query('DROP TABLE IF EXISTS '.$this->progressTable); @@ -323,9 +326,9 @@ function SaveData() { // copy data from temp permission cache table back to live - $this->Conn->Query('TRUNCATE '.TABLE_PREFIX.'PermCache'); + $this->Conn->Query('TRUNCATE '.TABLE_PREFIX.'CategoryPermissionsCache'); - $sql = 'INSERT INTO '.TABLE_PREFIX.'PermCache + $sql = 'INSERT INTO '.TABLE_PREFIX.'CategoryPermissionsCache SELECT * FROM '.$this->permCacheTable; $this->Conn->Query($sql); @@ -436,7 +439,7 @@ $fields_hash['l'.$language_id.'_CachedNavbar'] = implode('&|&', $data['titles'][$language_id]); } - $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$data['current_id']); + $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Categories', 'CategoryId = '.$data['current_id']); if ($this->Conn->getAffectedRows() > 0) { $this->Application->incrementCacheSerial('c', $data['current_id']); @@ -447,7 +450,7 @@ { $category_id = $data['current_id']; $sql = 'SELECT * - FROM '.TABLE_PREFIX.'Category + FROM '.TABLE_PREFIX.'Categories WHERE CategoryId = '.$category_id; $record = $this->Conn->GetRow($sql); @@ -465,14 +468,14 @@ // 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) { - $fields_hash = Array(); - if (!$record['Template']) { - $record['Template'] = $this->Application->ConfigValue($root_prefix.'_CategoryTemplate'); + if ( $root_prefix ) { + $fields_hash = Array (); + if ( !$record['Template'] ) { + $record['Template'] = $this->Application->ConfigValue($root_prefix . '_CategoryTemplate'); $fields_hash['Template'] = $record['Template']; } - $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$category_id); + $this->Conn->doUpdate($fields_hash, TABLE_PREFIX . 'Categories', 'CategoryId = ' . $category_id); }*/ // if explicitly set, then use it; use parent template otherwise @@ -486,7 +489,7 @@ function QueryChildren(&$data) { $sql = 'SELECT CategoryId - FROM '.TABLE_PREFIX.'Category + FROM '.TABLE_PREFIX.'Categories WHERE ParentId = '.$data['current_id']; $data['children'] = $this->Conn->GetCol($sql); } @@ -496,7 +499,7 @@ // don't search for section "view" permissions here :) $sql = 'SELECT ipc.PermissionConfigId, ip.GroupId, ip.PermissionValue FROM '.TABLE_PREFIX.'Permissions AS ip - LEFT JOIN '.TABLE_PREFIX.'PermissionConfig AS ipc ON ipc.PermissionName = ip.Permission + LEFT JOIN '.TABLE_PREFIX.'CategoryPermissionsConfig 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);