Merge pull request #1217 from nijel/remove-table-status
Remove workaround for older MySQL versions
This commit is contained in:
commit
0aa22fd223
@ -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
|
||||
----------------
|
||||
|
||||
|
||||
@ -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)) {
|
||||
|
||||
@ -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)
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user