adminerevo/adminer/processlist.inc.php

62 lines
1.9 KiB
PHP
Raw Permalink Normal View History

<?php
2021-02-12 15:08:40 +00:00
if (support("kill")) {
if ($_POST && !$error) {
$killed = 0;
foreach ((array) $_POST["kill"] as $val) {
if (kill_process($val)) {
$killed++;
}
}
2021-02-12 15:08:40 +00:00
queries_redirect(ME . "processlist=", lang('%d process(es) have been killed.', $killed), $killed || !$_POST["kill"]);
}
}
page_header(lang('Process list'), $error);
?>
<form action="" method="post">
2018-10-27 19:20:56 +00:00
<div class="scrollable">
2018-01-12 12:54:08 +00:00
<table cellspacing="0" class="nowrap checkable">
<?php
2018-01-12 14:27:44 +00:00
echo script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});");
2011-08-11 09:43:37 +00:00
// HTML valid because there is always at least one process
$i = -1;
2011-05-11 09:48:51 +00:00
foreach (process_list() as $i => $row) {
if (!$i) {
echo "<thead><tr lang='en'>" . (support("kill") ? "<th>" : "");
2013-04-18 00:57:14 +00:00
foreach ($row as $key => $val) {
2013-08-06 01:55:27 +00:00
echo "<th>$key" . doc_link(array(
'sql' => "show-processlist.html#processlist_" . strtolower($key),
'pgsql' => "monitoring-stats.html#PG-STAT-ACTIVITY-VIEW",
2019-08-27 14:33:36 +00:00
'oracle' => "REFRN30223",
2013-08-06 01:55:27 +00:00
));
2013-04-18 00:57:14 +00:00
}
echo "</thead>\n";
}
2016-02-28 20:30:52 +00:00
echo "<tr" . odd() . ">" . (support("kill") ? "<td>" . checkbox("kill[]", $row[$jush == "sql" ? "Id" : "pid"], 0) : "");
foreach ($row as $key => $val) {
2012-05-10 21:07:34 +00:00
echo "<td>" . (
($jush == "sql" && $key == "Info" && preg_match("~Query|Killed~", $row["Command"]) && $val != "") ||
2012-05-10 21:07:34 +00:00
($jush == "pgsql" && $key == "current_query" && $val != "<IDLE>") ||
($jush == "oracle" && $key == "sql_text" && $val != "")
? "<code class='jush-$jush'>" . shorten_utf8($val, 100, "</code>") . ' <a href="' . h(ME . ($row["db"] != "" ? "db=" . urlencode($row["db"]) . "&" : "") . "sql=" . urlencode($val)) . '">' . lang('Clone') . '</a>'
: h($val)
2012-05-10 21:07:34 +00:00
);
}
echo "\n";
}
?>
</table>
</div>
<p>
2011-05-11 09:48:51 +00:00
<?php
if (support("kill")) {
echo ($i + 1) . "/" . lang('%d in total', max_connections());
2011-05-11 09:48:51 +00:00
echo "<p><input type='submit' value='" . lang('Kill') . "'>\n";
}
?>
2011-03-08 12:43:05 +00:00
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>
2018-02-06 12:53:15 +00:00
<?php echo script("tableCheck();"); ?>