From 4c328aaf037f39d06d498f7e61bc42471f11f766 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 10 Jun 2014 09:32:32 +0200 Subject: [PATCH 1/2] Remove workaround for older MySQL versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove workaround originally implemented for MySQL < 5.0.2, but also useful in 5.1.x times for listing tables within database when permissions on one of database directories are wrong. I've tested this with several MySQL versions and it does not seem to be needed now, the INFORMATION SCHEMA works correctly even if some of the database directories have wrong permissions. Signed-off-by: Michal Čihař --- libraries/DatabaseInterface.class.php | 112 -------------------------- 1 file changed, 112 deletions(-) diff --git a/libraries/DatabaseInterface.class.php b/libraries/DatabaseInterface.class.php index d5a3a4246f..56c8b72ff1 100644 --- a/libraries/DatabaseInterface.class.php +++ b/libraries/DatabaseInterface.class.php @@ -540,118 +540,6 @@ class PMA_DatabaseInterface } // end (get information from table schema) - // If permissions are wrong on even one database directory, - // information_schema does not return any table info for any database - // this is why we fall back to SHOW TABLE STATUS even for MySQL >= 50002 - if (empty($tables) && !PMA_DRIZZLE) { - foreach ($databases as $each_database) { - if ($table || (true === $tbl_is_group) || $tble_type) { - $sql = 'SHOW TABLE STATUS FROM ' - . PMA_Util::backquote($each_database) - . ' WHERE'; - $needAnd = false; - if ($table || (true === $tbl_is_group)) { - $sql .= " `Name` LIKE '" - . PMA_Util::escapeMysqlWildcards( - PMA_Util::sqlAddSlashes($table, true) - ) - . "%'"; - $needAnd = true; - } - if ($tble_type) { - if ($needAnd) { - $sql .= " AND"; - } - if ($tble_type == 'view') { - $sql .= " `Comment` = 'VIEW'"; - } else if ($tble_type == 'table') { - $sql .= " `Comment` != 'VIEW'"; - } - } - } else { - $sql = 'SHOW TABLE STATUS FROM ' - . PMA_Util::backquote($each_database); - } - - $useStatusCache = false; - - if (extension_loaded('apc') - && isset($GLOBALS['cfg']['Server']['StatusCacheDatabases']) - && ! empty($GLOBALS['cfg']['Server']['StatusCacheLifetime']) - ) { - $statusCacheDatabases - = (array) $GLOBALS['cfg']['Server']['StatusCacheDatabases']; - if (in_array($each_database, $statusCacheDatabases)) { - $useStatusCache = true; - } - } - - $each_tables = null; - - if ($useStatusCache) { - $cacheKey = 'phpMyAdmin_tableStatus_' - . sha1($GLOBALS['cfg']['Server']['host'] . '_' . $sql); - - $each_tables = apc_fetch($cacheKey); - } - - if (! $each_tables) { - $each_tables = $this->fetchResult($sql, 'Name', null, $link); - } - - if ($useStatusCache) { - apc_store( - $cacheKey, $each_tables, - $GLOBALS['cfg']['Server']['StatusCacheLifetime'] - ); - } - - // Sort naturally if the config allows it and we're sorting - // the Name column. - if ($sort_by == 'Name' && $GLOBALS['cfg']['NaturalOrder']) { - uksort($each_tables, 'strnatcasecmp'); - - if ($sort_order == 'DESC') { - $each_tables = array_reverse($each_tables); - } - } else { - // Prepare to sort by creating array of the selected sort - // value to pass to array_multisort - - // Size = Data_length + Index_length - if ($sort_by == 'Data_length') { - foreach ($each_tables as $table_name => $table_data) { - ${$sort_by}[$table_name] = strtolower( - $table_data['Data_length'] - + $table_data['Index_length'] - ); - } - } else { - foreach ($each_tables as $table_name => $table_data) { - ${$sort_by}[$table_name] - = strtolower($table_data[$sort_by]); - } - } - - if ($sort_order == 'DESC') { - array_multisort($$sort_by, SORT_DESC, $each_tables); - } else { - array_multisort($$sort_by, SORT_ASC, $each_tables); - } - } - - if ($limit_count) { - $each_tables = array_slice( - $each_tables, $limit_offset, $limit_count - ); - } - - $tables[$each_database] = $this->copyTableProperties( - $each_tables, $each_database - ); - } - } - $this->_cacheTableData($tables, $table); if (! is_array($database)) { From 96366ce7bc3b2356022185714e37413c2610ab72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 10 Jun 2014 09:40:13 +0200 Subject: [PATCH 2/2] Remove no longer used caching configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- doc/config.rst | 19 ------------------- libraries/config.default.php | 17 ----------------- 2 files changed, 36 deletions(-) diff --git a/doc/config.rst b/doc/config.rst index b468c5bb59..4ce3cbe915 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -1056,25 +1056,6 @@ Server connection settings after logout (doesn't affect config authentication method). Should be absolute including protocol. -.. config:option:: $cfg['Servers'][$i]['StatusCacheDatabases'] - - :type: array of strings - :default: array() - - Enables caching of ``TABLE STATUS`` outputs for specific databases on - this server (in some cases ``TABLE STATUS`` can be very slow, so you - may want to cache it). APC is used (if the PHP extension is available, - if not, this setting is ignored silently). You have to provide - :config:option:`$cfg['Servers'][$i]['StatusCacheLifetime']`. - -.. config:option:: $cfg['Servers'][$i]['StatusCacheLifetime'] - - :type: integer - :default: 0 - - Lifetime in seconds of the ``TABLE STATUS`` cache if - :config:option:`$cfg['Servers'][$i]['StatusCacheDatabases']` is used. - Generic settings ---------------- diff --git a/libraries/config.default.php b/libraries/config.default.php index e4b74baa89..d33b1fffe7 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -578,23 +578,6 @@ $cfg['Servers'][$i]['tracking_add_drop_table'] = true; $cfg['Servers'][$i]['tracking_add_drop_database'] = true; -/** - * Enables caching of TABLE STATUS outputs for specific databases on this server - * (in some cases TABLE STATUS can be very slow, so you may want to cache it). - * APC is used (if the PHP extension is available, if not, this setting is ignored - * silently). You have to provide StatusCacheLifetime. - * - * @global array $cfg['Servers'][$i]['StatusCacheDatabases'] - */ -$cfg['Servers'][$i]['StatusCacheDatabases'] = array(); - -/** - * Lifetime in seconds of the TABLE STATUS cache if StatusCacheDatabases is used - * - * @global integer $cfg['Servers'][$i]['StatusCacheLifetime'] - */ -$cfg['Servers'][$i]['StatusCacheLifetime'] = 0; - /** * Default server (0 = no default server) *