diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | libraries/classes/Server/Status/Processes.php | 39 | ||||
-rw-r--r-- | psalm-baseline.xml | 3 | ||||
-rw-r--r-- | templates/server/status/processes/list.twig | 26 | ||||
-rw-r--r-- | test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php | 4 | ||||
-rw-r--r-- | test/classes/Controllers/Server/Status/ProcessesControllerTest.php | 2 | ||||
-rw-r--r-- | test/classes/Stubs/DbiDummy.php | 2 |
7 files changed, 50 insertions, 27 deletions
@@ -11,6 +11,7 @@ phpMyAdmin - ChangeLog - issue #17496 Fix error in table operation page when partitions are broken - issue #17386 Fix system memory and system swap values on Windows - issue #17517 Fix Database Server panel not getting hidden by ShowServerInfo configuration directive +- issue #17271 Fix database names not showing on Processes tab 5.2.0 (2022-05-10) - issue #16521 Upgrade Bootstrap to version 5 diff --git a/libraries/classes/Server/Status/Processes.php b/libraries/classes/Server/Status/Processes.php index 3ac414d8d1..7af9f34f39 100644 --- a/libraries/classes/Server/Status/Processes.php +++ b/libraries/classes/Server/Status/Processes.php @@ -70,26 +70,21 @@ final class Processes 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 @@ final class Processes ], [ 'column_name' => __('Database'), - 'order_by_field' => 'db', + 'order_by_field' => 'Db', ], [ 'column_name' => __('Command'), @@ -138,14 +133,18 @@ final class Processes 'column_name' => __('Status'), 'order_by_field' => 'State', ], - [ + ]; + + if ($this->dbi->isMariaDB()) { + $sortableColumns[] = [ 'column_name' => __('Progress'), 'order_by_field' => 'Progress', - ], - [ - 'column_name' => __('SQL query'), - 'order_by_field' => 'Info', - ], + ]; + } + + $sortableColumns[] = [ + 'column_name' => __('SQL query'), + 'order_by_field' => 'Info', ]; $sortableColCount = count($sortableColumns); diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 09db27f827..91573894d5 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -12783,6 +12783,9 @@ <MixedOperand occurrences="1"> <code>$params['sort_order']</code> </MixedOperand> + <RedundantCondition occurrences="1"> + <code>0 !== --$sortableColCount</code> + </RedundantCondition> </file> <file src="libraries/classes/Session.php"> <MixedArgument occurrences="3"> diff --git a/templates/server/status/processes/list.twig b/templates/server/status/processes/list.twig index 4492f3b1a5..44ed19769a 100644 --- a/templates/server/status/processes/list.twig +++ b/templates/server/status/processes/list.twig @@ -45,11 +45,29 @@ </a> </td> <td class="font-monospace text-end">{{ row.id }}</td> - <td>{{ row.user }}</td> + <td> + {% if row.user != 'system user' %} + <a href="{{ url('/server/privileges', { + 'username': row.user, + 'hostname': row.host, + 'dbname': row.db, + 'tablename': '', + 'routinename': '', + }) }}"> + {{ row.user }} + </a> + {% else %} + {{ row.user }} + {% endif %} + </td> <td>{{ row.host }}</td> <td> {% if row.db != '' %} - {{ row.db }} + <a href="{{ url('/database/structure', { + 'db': row.db, + }) }}"> + {{ row.db }} + </a> {% else %} <em>{% trans 'None' %}</em> {% endif %} @@ -57,7 +75,9 @@ <td>{{ row.command }}</td> <td class="font-monospace text-end">{{ row.time }}</td> <td>{{ row.state }}</td> - <td>{{ row.progress }}</td> + {% if is_mariadb %} + <td>{{ row.progress }}</td> + {% endif %} <td>{{ row.info|raw }}</td> {% endfor %} </tbody> diff --git a/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php b/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php index 8835e2deb0..f4ac71e9f9 100644 --- a/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php +++ b/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php @@ -46,7 +46,7 @@ class RefreshControllerTest extends AbstractTestCase 'User' => 'User1', 'Host' => 'Host1', 'Id' => 'Id1', - 'db' => 'db1', + 'Db' => 'db1', 'Command' => 'Command1', 'Info' => 'Info1', 'State' => 'State1', @@ -95,7 +95,7 @@ class RefreshControllerTest extends AbstractTestCase //validate 4: $process['db'] $this->assertStringContainsString( - __('None'), + $process['Db'], $html ); diff --git a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php index 324d9cc64e..2102ba3bce 100644 --- a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php +++ b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php @@ -77,7 +77,7 @@ class ProcessesControllerTest extends AbstractTestCase $_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'); diff --git a/test/classes/Stubs/DbiDummy.php b/test/classes/Stubs/DbiDummy.php index 325c64de12..ea2718645d 100644 --- a/test/classes/Stubs/DbiDummy.php +++ b/test/classes/Stubs/DbiDummy.php @@ -2334,7 +2334,7 @@ class DbiDummy implements DbiExtension 'result' => [['Id1', 'User1', 'Host1', 'db1', 'Command1', 'Time1', 'State1', 'Info1']], ], [ - 'query' => 'SELECT * FROM `INFORMATION_SCHEMA`.`PROCESSLIST` ORDER BY `db` ASC', + 'query' => 'SELECT * FROM `INFORMATION_SCHEMA`.`PROCESSLIST` ORDER BY `Db` ASC', 'columns' => ['Id', 'User', 'Host', 'db', 'Command', 'Time', 'State', 'Info'], 'result' => [['Id1', 'User1', 'Host1', 'db1', 'Command1', 'Time1', 'State1', 'Info1']], ], |