Index: db_connection.php =================================================================== --- db_connection.php (revision 14719) +++ db_connection.php (working copy) @@ -920,22 +920,30 @@ * Allows to detect table's presence in database * * @param string $table_name + * @param bool $force * @return bool * @access public */ - public function TableFound($table_name) + public function TableFound($table_name, $force = false) { - static $table_found = Array(); + static $table_found = false; + if ($table_found === false) { + $table_found = array_flip($this->GetCol('SHOW TABLES')); + } + if (!preg_match('/^'.preg_quote(TABLE_PREFIX, '/').'(.*)/', $table_name)) { $table_name = TABLE_PREFIX.$table_name; } - if (!isset($table_found[$table_name])) { - $table_found[$table_name] = $this->Query('SHOW TABLES LIKE "'.$table_name.'"'); + if ($force) { + if ($this->Query('SHOW TABLES LIKE "'.$table_name.'"')) { + $table_found[$table_name] = 1; + } else { + unset($table_found[$table_name]); + } } - - return $table_found[$table_name]; + return isset($table_found[$table_name]); } /**