From c310304712e010100265efcd54352aafd8623eba Mon Sep 17 00:00:00 2001 From: Pavel Rochnyack Date: Wed, 27 Jul 2016 17:57:44 +0100 Subject: [PATCH] Restore Overhead column in Server > Databases > Enable Statistics. (Was removed in 582b02262bcda6edb10ffc6df1b67c47468bbe59) Signed-off-by: Pavel Rochnyack --- libraries/DatabaseInterface.php | 3 ++- .../controllers/server/ServerDatabasesController.php | 8 +++++--- .../classes/controllers/ServerDatabasesControllerTest.php | 5 +++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libraries/DatabaseInterface.php b/libraries/DatabaseInterface.php index 114132ee9c..b394b01b43 100644 --- a/libraries/DatabaseInterface.php +++ b/libraries/DatabaseInterface.php @@ -871,7 +871,8 @@ class DatabaseInterface SUM(t.INDEX_LENGTH) AS SCHEMA_INDEX_LENGTH, SUM(t.DATA_LENGTH + t.INDEX_LENGTH) AS SCHEMA_LENGTH, - SUM(t.DATA_FREE) AS SCHEMA_DATA_FREE'; + SUM(IF(t.ENGINE <> \'InnoDB\', t.DATA_FREE, 0)) + AS SCHEMA_DATA_FREE'; } $sql .= ' FROM `information_schema`.SCHEMATA s'; diff --git a/libraries/controllers/server/ServerDatabasesController.php b/libraries/controllers/server/ServerDatabasesController.php index a8e2a46f2c..29db80d5c8 100644 --- a/libraries/controllers/server/ServerDatabasesController.php +++ b/libraries/controllers/server/ServerDatabasesController.php @@ -357,9 +357,11 @@ class ServerDatabasesController extends Controller 'format' => 'byte', 'footer' => 0, ); - // At this point we were preparing the display of Overhead using DATA_FREE - // but its content does not represent the real overhead in the case - // of InnoDB + $column_order['SCHEMA_DATA_FREE'] = array( + 'disp_name' => __('Overhead'), + 'format' => 'byte', + 'footer' => 0, + ); return $column_order; } diff --git a/test/classes/controllers/ServerDatabasesControllerTest.php b/test/classes/controllers/ServerDatabasesControllerTest.php index 11b583067f..3c7984a3d0 100644 --- a/test/classes/controllers/ServerDatabasesControllerTest.php +++ b/test/classes/controllers/ServerDatabasesControllerTest.php @@ -311,6 +311,11 @@ class ServerDatabasesControllerTest extends PMATestCase 'disp_name' => __('Total'), 'format' => 'byte', 'footer' => 0 + ), + 'SCHEMA_DATA_FREE' => array( + 'disp_name' => __('Overhead'), + 'format' => 'byte', + 'footer' => 0 ) ), $method->invoke($ctrl)