Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 48 lines (45 sloc) 1.669 kb
8dd02b8 Processlist
jakubvrana authored
1 <?php
06aa0f8 Jan Dolecek Process list for PostgreSQL
juzna authored
2 if (support("kill") && $_POST && !$error) {
8dd02b8 Processlist
jakubvrana authored
3 $killed = 0;
4 foreach ((array) $_POST["kill"] as $val) {
5002b89 Jakub Vrána Big numbers without E
authored
5 if (queries("KILL " . (+$val))) {
8dd02b8 Processlist
jakubvrana authored
6 $killed++;
7 }
8 }
dbdd40a Introduce queries_redirect function
jakubvrana authored
9 queries_redirect(ME . "processlist=", lang('%d process(es) have been killed.', $killed), $killed || !$_POST["kill"]);
8dd02b8 Processlist
jakubvrana authored
10 }
36d6864 Whitespace
jakubvrana authored
11
eff527b Move error output to page_header()
jakubvrana authored
12 page_header(lang('Process list'), $error);
8dd02b8 Processlist
jakubvrana authored
13 ?>
14
15 <form action="" method="post">
023b62a Jakub Vrána Highlight checked rows
authored
16 <table cellspacing="0" onclick="tableClick(event);" class="nowrap checkable">
8dd02b8 Processlist
jakubvrana authored
17 <?php
1370d29 Jakub Vrána Comment
authored
18 // HTML valid because there is always at least one process
3fad0c6 Jakub Vrána Show number of connections (thanks to fos4)
authored
19 $i = -1;
06aa0f8 Jan Dolecek Process list for PostgreSQL
juzna authored
20 foreach (process_list() as $i => $row) {
8dd02b8 Processlist
jakubvrana authored
21 if (!$i) {
06aa0f8 Jan Dolecek Process list for PostgreSQL
juzna authored
22 echo "<thead><tr lang='en'>" . (support("kill") ? "<th>&nbsp;" : "") . "<th>" . implode("<th>", array_keys($row)) . "</thead>\n";
8dd02b8 Processlist
jakubvrana authored
23 }
06aa0f8 Jan Dolecek Process list for PostgreSQL
juzna authored
24 echo "<tr" . odd() . ">" . (support("kill") ? "<td>" . checkbox("kill[]", $row["Id"], 0) : "");
84d9ecf Jakub Vrána Highlight and edit SQL command in processlist
authored
25 foreach ($row as $key => $val) {
d6c5f85 helix84 Add Oracle processlist support
helix84 authored
26 echo "<td>" . (
5e4b815 Jakub Vrána Highlight also killed queries
authored
27 ($jush == "sql" && $key == "Info" && ereg("Query|Killed", $row["Command"]) && $val != "") ||
d6c5f85 helix84 Add Oracle processlist support
helix84 authored
28 ($jush == "pgsql" && $key == "current_query" && $val != "<IDLE>") ||
29 ($jush == "oracle" && $key == "sql_text" && $val != "")
30 ? "<code class='jush-$jush'>" . shorten_utf8($val, 100, "</code>") . ' <a href="' . h(ME . ($row["db"] != "" ? "db=" . urlencode($row["db"]) . "&" : "") . "sql=" . urlencode($val)) . '">' . lang('Edit') . '</a>'
31 : nbsp($val)
32 );
84d9ecf Jakub Vrána Highlight and edit SQL command in processlist
authored
33 }
34 echo "\n";
8dd02b8 Processlist
jakubvrana authored
35 }
36 ?>
37 </table>
023b62a Jakub Vrána Highlight checked rows
authored
38 <script type='text/javascript'>tableCheck();</script>
8dd02b8 Processlist
jakubvrana authored
39 <p>
06aa0f8 Jan Dolecek Process list for PostgreSQL
juzna authored
40 <?php
41 if (support("kill")) {
42 echo ($i + 1) . "/" . lang('%d in total', $connection->result("SELECT @@max_connections"));
43 echo "<p><input type='submit' value='" . lang('Kill') . "'>\n";
44 }
45 ?>
740ae10 Jakub Vrána Don't send incomplete forms
authored
46 <input type="hidden" name="token" value="<?php echo $token; ?>">
8dd02b8 Processlist
jakubvrana authored
47 </form>
Something went wrong with that request. Please try again.