diff --git a/install/tools/7-finish.php b/install/tools/7-finish.php index 7995a72c..f9c50671 100644 --- a/install/tools/7-finish.php +++ b/install/tools/7-finish.php @@ -74,7 +74,7 @@ if(ModelsFAQ::count() == 0) { ]); } -clearCache(); +$db->setClearCacheAfter(true); $locale['step_finish_desc'] = str_replace('$ADMIN_PANEL$', generateLink(str_replace('tools/', '',ADMIN_URL), $locale['step_finish_admin_panel'], true), $locale['step_finish_desc']); $locale['step_finish_desc'] = str_replace('$HOMEPAGE$', generateLink(str_replace('tools/', '', BASE_URL), $locale['step_finish_homepage'], true), $locale['step_finish_desc']); diff --git a/system/functions.php b/system/functions.php index ff646600..7cce4d54 100644 --- a/system/functions.php +++ b/system/functions.php @@ -1213,7 +1213,6 @@ function clearCache() 'towns', 'groups', 'vocations', 'visitors', 'views_counter', 'failed_logins', 'template_menus', - 'database_tables', 'database_columns', 'database_checksum', 'last_kills', 'hooks', 'plugins_hooks', 'plugins_routes', 'plugins_settings', 'plugins_themes', 'plugins_commands', 'settings', @@ -1242,6 +1241,9 @@ function clearCache() $cache->delete($item); } } + + global $db; + $db->setClearCacheAfter(true); } deleteDirectory(CACHE . 'signatures', ['index.html'], true); diff --git a/system/libs/pot/OTS_DB_MySQL.php b/system/libs/pot/OTS_DB_MySQL.php index 312225d3..5ca7d28b 100644 --- a/system/libs/pot/OTS_DB_MySQL.php +++ b/system/libs/pot/OTS_DB_MySQL.php @@ -28,6 +28,8 @@ class OTS_DB_MySQL extends OTS_Base_DB { private $has_table_cache = array(); private $has_column_cache = array(); + + private $clearCacheAfter = false; /** * Creates database connection. * @@ -96,7 +98,8 @@ class OTS_DB_MySQL extends OTS_Base_DB } global $config; - if(class_exists('Cache') && ($cache = Cache::getInstance()) && $cache->enabled()) { + $cache = Cache::getInstance(); + if($cache->enabled()) { $tmp = null; $need_revalidation = true; if($cache->fetch('database_checksum', $tmp) && $tmp) { @@ -147,10 +150,18 @@ class OTS_DB_MySQL extends OTS_Base_DB { global $config; - if(class_exists('Cache') && ($cache = Cache::getInstance()) && $cache->enabled()) { - $cache->set('database_tables', serialize($this->has_table_cache), 3600); - $cache->set('database_columns', serialize($this->has_column_cache), 3600); - $cache->set('database_checksum', serialize(sha1($config['database_host'] . '.' . $config['database_name'])), 3600); + $cache = Cache::getInstance(); + if($cache->enabled()) { + if ($this->clearCacheAfter) { + $cache->delete('database_tables'); + $cache->delete('database_columns'); + $cache->delete('database_checksum'); + } + else { + $cache->set('database_tables', serialize($this->has_table_cache), 3600); + $cache->set('database_columns', serialize($this->has_column_cache), 3600); + $cache->set('database_checksum', serialize(sha1($config['database_host'] . '.' . $config['database_name'])), 3600); + } } if($this->logged) { @@ -238,6 +249,11 @@ class OTS_DB_MySQL extends OTS_Base_DB } } } + + public function setClearCacheAfter($clearCache) + { + $this->clearCacheAfter = $clearCache; + } } /**#@-*/