Use sha1 instead of md5, reorder conditions for table status caching and avoid too many if's

This commit is contained in:
Nico Kaiser 2012-05-10 14:48:35 +02:00
parent e7cccad2c3
commit 9853c5dea8

View File

@ -517,22 +517,19 @@ function PMA_DBI_get_tables_full($database, $table = false,
$useStatusCache = false;
if (isset($GLOBALS['cfg']['Server']['StatusCacheDatabases'])) {
if (!empty($GLOBALS['cfg']['Server']['StatusCacheLifetime'])) {
if (extension_loaded('apc')) {
$statusCacheDatabases = (array) $GLOBALS['cfg']['Server']['StatusCacheDatabases'];
if (in_array($each_database, $statusCacheDatabases)) {
$useStatusCache = true;
}
}
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_' . md5($GLOBALS['cfg']['Server']['host'] . '_' . $sql);
$cacheKey = 'phpMyAdmin_tableStatus_' . sha1($GLOBALS['cfg']['Server']['host'] . '_' . $sql);
$each_tables = apc_fetch($cacheKey);
}