]> git.joonet.de Git - adminer.git/commitdiff
improved kill command support for MySQL and initial support for PgSQL
authorBernhard J. M. Gruen <bernhard.gruen@netrapid.de>
Wed, 18 Mar 2015 09:34:35 +0000 (10:34 +0100)
committerJakub Vrana <jakub@vrana.cz>
Sun, 28 Feb 2016 20:27:45 +0000 (12:27 -0800)
adminer/drivers/mysql.inc.php
adminer/drivers/pgsql.inc.php
adminer/include/version.inc.php
adminer/processlist.inc.php
changes.txt

index 0a919d6da19936459cbf82d0d5c0a83c7b0ce30e..c9b44ae1d13db8ae62e136c7f81ce3541c458535 100644 (file)
@@ -1015,6 +1015,16 @@ if (!defined("DRIVER")) {
                return !preg_match("~scheme|sequence|type|view_trigger" . ($connection->server_info < 5.1 ? "|event|partitioning" . ($connection->server_info < 5 ? "|routine|trigger|view" : "") : "") . "~", $feature);
        }
 
+       function kill_process($val) {
+               return queries("KILL " . number($val));
+       }
+
+       function max_connections() {
+               global $connection;
+               return $connection->result("SELECT @@max_connections");
+       }
+
+       $id_name = "Id";
        $jush = "sql"; ///< @var string JUSH identifier
        $types = array(); ///< @var array ($type => $maximum_unsigned_length, ...)
        $structured_types = array(); ///< @var array ($description => array($type, ...), ...)
index 22c9142d36c2323f4007272d9fa5a818d8ec2d42..87b69b2f0a17a2912d28ae2c293fc334bdeba5c5 100644 (file)
@@ -631,9 +631,19 @@ AND typelem = 0"
 
        function support($feature) {
                global $connection;
-               return preg_match('~^(database|table|columns|sql|indexes|comment|view|' . ($connection->server_info >= 9.3 ? 'materializedview|' : '') . 'scheme|processlist|sequence|trigger|type|variables|drop_col)$~', $feature); //! routine|
+               return preg_match('~^(database|table|columns|sql|indexes|comment|view|' . ($connection->server_info >= 9.3 ? 'materializedview|' : '') . 'scheme|processlist|sequence|trigger|type|variables|drop_col|kill)$~', $feature); //! routine|
        }
 
+       function kill_process($val) {
+               return queries("SELECT pg_terminate_backend(" . number($val).")");
+       }
+
+       function max_connections() {
+               global $connection;
+               return $connection->result("SHOW max_connections");
+       }
+
+       $id_name = "pid";
        $jush = "pgsql";
        $types = array();
        $structured_types = array();
index a6781a30125c19d82857dd9c723d576afbe7f710..4eebbcf6f7b0c55782cb0ecc4dca311dd0b778db 100644 (file)
@@ -1,2 +1,2 @@
 <?php
-$VERSION = "4.2.4";
+$VERSION = "4.2.5-dev";
index ce60bcfc83ab5638a488bf73fddd7e4757f92bee..d798f8d8a35e9477d3c9a374f6c3b59ece4ec8d4 100644 (file)
@@ -2,7 +2,7 @@
 if (support("kill") && $_POST && !$error) {
        $killed = 0;
        foreach ((array) $_POST["kill"] as $val) {
-               if (queries("KILL " . number($val))) {
+               if (kill_process($val)) {
                        $killed++;
                }
        }
@@ -30,8 +30,7 @@ foreach (process_list() as $i => $row) {
                }
                echo "</thead>\n";
        }
-
-       echo "<tr" . odd() . ">" . (support("kill") ? "<td>" . checkbox("kill[]", $row["Id"], 0) : "");
+       echo "<tr" . odd() . ">" . (support("kill") ? "<td>" . checkbox("kill[]", $row[$id_name], 0) : "");
        foreach ($row as $key => $val) {
                echo "<td>" . (
                        ($jush == "sql" && $key == "Info" && preg_match("~Query|Killed~", $row["Command"]) && $val != "") ||
@@ -49,7 +48,7 @@ foreach (process_list() as $i => $row) {
 <p>
 <?php
 if (support("kill")) {
-       echo ($i + 1) . "/" . lang('%d in total', $connection->result("SELECT @@max_connections"));
+       echo ($i + 1) . "/" . lang('%d in total', max_connections());
        echo "<p><input type='submit' value='" . lang('Kill') . "'>\n";
 }
 ?>
index 6f3e30d6e5656102bca83b80513c19b336c2770f..986015f91bc3781798d579e020fe8631eb3d98bb 100644 (file)
@@ -1,3 +1,6 @@
+Adminer 4.2.5-dev:
+PostgreSQL: Support KILL
+
 Adminer 4.2.4 (released 2016-02-06):
 Fix remote execution in SQLite query
 MySQL: Support PHP 7