From fb1afbe44489fce3746f28f34ac7250ffbf5bf62 Mon Sep 17 00:00:00 2001 From: Liviu-Mihail Concioiu Date: Mon, 30 May 2022 00:44:38 +0200 Subject: [PATCH] Fix database names dissapearing from Processes tab Signed-off-by: Liviu-Mihail Concioiu --- libraries/classes/Server/Status/Processes.php | 23 ++++++++----------- .../Server/Status/ProcessesControllerTest.php | 2 +- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/libraries/classes/Server/Status/Processes.php b/libraries/classes/Server/Status/Processes.php index 3ac414d8d13c..19b9b26a17d7 100644 --- a/libraries/classes/Server/Status/Processes.php +++ b/libraries/classes/Server/Status/Processes.php @@ -70,26 +70,21 @@ public function getList(array $params): array while ($process = $result->fetchAssoc()) { // Array keys need to modify due to the way it has used // to display column values - if ( - (! empty($params['order_by_field']) && ! empty($params['sort_order'])) - || ! empty($params['showExecuting']) - ) { - foreach (array_keys($process) as $key) { - $newKey = ucfirst(mb_strtolower($key)); - if ($newKey === $key) { - continue; - } - - $process[$newKey] = $process[$key]; - unset($process[$key]); + foreach (array_keys($process) as $key) { + $newKey = ucfirst(mb_strtolower($key)); + if ($newKey === $key) { + continue; } + + $process[$newKey] = $process[$key]; + unset($process[$key]); } $rows[] = [ 'id' => $process['Id'], 'user' => $process['User'], 'host' => $process['Host'], - 'db' => ! isset($process['db']) || strlen($process['db']) === 0 ? '' : $process['db'], + 'db' => ! isset($process['Db']) || strlen($process['Db']) === 0 ? '' : $process['Db'], 'command' => $process['Command'], 'time' => $process['Time'], 'state' => ! empty($process['State']) ? $process['State'] : '---', @@ -124,7 +119,7 @@ private function getSortableColumnsForProcessList(bool $showFullSql, array $para ], [ 'column_name' => __('Database'), - 'order_by_field' => 'db', + 'order_by_field' => 'Db', ], [ 'column_name' => __('Command'), diff --git a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php index 324d9cc64e21..2102ba3bce8f 100644 --- a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php +++ b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php @@ -77,7 +77,7 @@ public function testIndex(): void $_POST['full'] = '1'; $_POST['column_name'] = 'Database'; - $_POST['order_by_field'] = 'db'; + $_POST['order_by_field'] = 'Db'; $_POST['sort_order'] = 'ASC'; $this->dummyDbi->addSelectDb('mysql');