Index: branches/5.2.x/core/kernel/managers/cache_manager.php =================================================================== diff -u -N -r14995 -r15012 --- branches/5.2.x/core/kernel/managers/cache_manager.php (.../cache_manager.php) (revision 14995) +++ branches/5.2.x/core/kernel/managers/cache_manager.php (.../cache_manager.php) (revision 15012) @@ -1,6 +1,6 @@ settingTableName = TABLE_PREFIX . 'SystemSettings'; + + if ( defined('IS_INSTALL') && IS_INSTALL ) { + // table substitution required, so "root" can perform login to upgrade to 5.2.0, where setting table was renamed + if ( !$this->Application->TableFound(TABLE_PREFIX . 'SystemSettings') ) { + $this->settingTableName = TABLE_PREFIX . 'ConfigurationValues'; + } + } + } + /** * Creates caching manager instance * * @access public @@ -153,7 +180,7 @@ } $sql = 'SELECT VariableValue, VariableName - FROM ' . TABLE_PREFIX . 'ConfigurationValues + FROM ' . $this->settingTableName . ' WHERE VariableId IN (' . implode(',', $this->originalConfigIDs) . ')'; $config_variables = $this->Conn->GetCol($sql, 'VariableName'); @@ -186,13 +213,13 @@ return $this->configVariables[$name]; } - if ( defined('IS_INSTALL') && IS_INSTALL && !$this->Application->TableFound('ConfigurationValues', true) ) { + if ( defined('IS_INSTALL') && IS_INSTALL && !$this->Application->TableFound($this->settingTableName, true) ) { return false; } $this->Conn->nextQueryCachable = true; $sql = 'SELECT VariableId, VariableValue - FROM ' . TABLE_PREFIX . 'ConfigurationValues + FROM ' . $this->settingTableName . ' WHERE VariableName = ' . $this->Conn->qstr($name); $res = $this->Conn->GetRow($sql); @@ -226,7 +253,7 @@ } $fields_hash = Array ('VariableValue' => $value); - $this->Conn->doUpdate($fields_hash, TABLE_PREFIX . 'ConfigurationValues', 'VariableName = ' . $this->Conn->qstr($name)); + $this->Conn->doUpdate($fields_hash, $this->settingTableName, 'VariableName = ' . $this->Conn->qstr($name)); if ( array_key_exists($name, $this->originalConfigVariables) && $value != $this->originalConfigVariables[$name] ) { $this->DeleteUnitCache(); @@ -425,7 +452,7 @@ $escaped_config_vars = $this->Conn->qstrArray($config_vars); $sql = 'SELECT VariableId, VariableName, VariableValue - FROM ' . TABLE_PREFIX . 'ConfigurationValues + FROM ' . $this->settingTableName . ' WHERE VariableName IN (' . implode(',', $escaped_config_vars) . ')'; $data = $this->Conn->Query($sql, 'VariableId'); @@ -606,7 +633,7 @@ $this->Conn->nextQueryCachable = true; $sql = 'SELECT Data, Cached, LifeTime - FROM ' . TABLE_PREFIX . 'Cache + FROM ' . TABLE_PREFIX . 'SystemCache WHERE VarName = ' . $this->Conn->qstr($name); $data = $this->Conn->GetRow($sql); @@ -616,7 +643,7 @@ // delete expired $this->Conn->nextQueryCachable = true; - $sql = 'DELETE FROM ' . TABLE_PREFIX . 'Cache + $sql = 'DELETE FROM ' . TABLE_PREFIX . 'SystemCache WHERE VarName = ' . $this->Conn->qstr($name); $this->Conn->Query($sql); @@ -666,7 +693,7 @@ ); $this->Conn->nextQueryCachable = true; - $this->Conn->doInsert($fields_hash, TABLE_PREFIX . 'Cache', 'REPLACE'); + $this->Conn->doInsert($fields_hash, TABLE_PREFIX . 'SystemCache', 'REPLACE'); } /** @@ -699,7 +726,7 @@ */ public function deleteDBCache($name) { - $sql = 'DELETE FROM ' . TABLE_PREFIX . 'Cache + $sql = 'DELETE FROM ' . TABLE_PREFIX . 'SystemCache WHERE VarName = ' . $this->Conn->qstr($name); $this->Conn->Query($sql); } @@ -762,7 +789,7 @@ // this allows to save 2 sql queries for each category $this->Conn->nextQueryCachable = true; $sql = 'SELECT NamedParentPath, CachedTemplate, TreeLeft, TreeRight - FROM ' . TABLE_PREFIX . 'Category + FROM ' . TABLE_PREFIX . 'Categories WHERE CategoryId = ' . (int)$category_id; $category_data = $this->Conn->GetRow($sql);