From 8bab3325b3e1bb66aa1a89322e0d0a5692c039bd Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 4 Jan 2014 15:00:01 +0530 Subject: [PATCH] Size = Data_length + Index_length Signed-off-by: Madhura Jayaratne --- libraries/DatabaseInterface.class.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/libraries/DatabaseInterface.class.php b/libraries/DatabaseInterface.class.php index 225ca69645..ff1931c58a 100644 --- a/libraries/DatabaseInterface.class.php +++ b/libraries/DatabaseInterface.class.php @@ -478,6 +478,24 @@ class PMA_DatabaseInterface foreach ($tables as $one_database_name => $one_database_tables) { uksort($one_database_tables, 'strnatcasecmp'); + if ($sort_order == 'DESC') { + $one_database_tables = array_reverse($one_database_tables); + } + $tables[$one_database_name] = $one_database_tables; + } + } else if ($sort_by == 'Data_length') { // Size = Data_length + Index_length + foreach ($tables as $one_database_name => $one_database_tables) { + uasort( + $one_database_tables, + function($a, $b) { + $aLength = $a['Data_length'] + $a['Index_length']; + $bLength = $b['Data_length'] + $b['Index_length']; + return ($aLength == $bLength) + ? 0 + : ($aLength < $bLength) ? -1 : 1; + } + ); + if ($sort_order == 'DESC') { $one_database_tables = array_reverse($one_database_tables); } @@ -680,7 +698,7 @@ class PMA_DatabaseInterface // we would lose a db name thats consists only of numbers foreach ($tables as $one_database => $its_tables) { if (isset(PMA_Table::$cache[$one_database])) { - // the + operator does not do the intended effect + // the + operator does not do the intended effect // when the cache for one table already exists if ($table && isset(PMA_Table::$cache[$one_database][$table])