Skip to content

Commit

Permalink
Fix database names dissapearing from Processes tab
Browse files Browse the repository at this point in the history
Signed-off-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>
  • Loading branch information
liviuconcioiu committed May 29, 2022
1 parent e9a5ec0 commit fb1afbe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
23 changes: 9 additions & 14 deletions libraries/classes/Server/Status/Processes.php
Expand Up @@ -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'] : '---',
Expand Down Expand Up @@ -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'),
Expand Down
Expand Up @@ -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');
Expand Down

0 comments on commit fb1afbe

Please sign in to comment.