-
Notifications
You must be signed in to change notification settings - Fork 1
/
server_processlist.php
114 lines (106 loc) · 3.52 KB
/
server_processlist.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
* @package phpMyAdmin
*/
/**
*
*/
require_once './libraries/common.inc.php';
require_once './libraries/server_common.inc.php';
require './libraries/server_links.inc.php';
/**
* Displays the sub-page heading
*/
echo '<h2>' . "\n"
. ($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $pmaThemeImage . 's_process.png" width="16" height="16" border="0" hspace="2" align="middle" alt="" />' : '')
. ' ' . __('Processes') . "\n"
. '</h2>' . "\n";
/**
* Kills a selected process
*/
if (!empty($_REQUEST['kill'])) {
if (PMA_DBI_try_query('KILL ' . $_REQUEST['kill'] . ';')) {
$message = PMA_Message::success(__('Thread %s was successfully killed.'));
} else {
$message = PMA_Message::error(__('phpMyAdmin was unable to kill thread %s. It probably has already been closed.'));
}
$message->addParam($_REQUEST['kill']);
$message->display();
}
$url_params = array();
if (! empty($_REQUEST['full'])) {
$sql_query = 'SHOW FULL PROCESSLIST';
$url_params['full'] = 1;
$full_text_link = 'server_processlist.php' . PMA_generate_common_url(array(), 'html', '?');
} else {
$sql_query = 'SHOW PROCESSLIST';
$full_text_link = 'server_processlist.php' . PMA_generate_common_url(array('full' => 1));
}
$result = PMA_DBI_query($sql_query);
/**
* Displays the page
*/
?>
<table id="tableprocesslist" class="data">
<thead>
<tr>
<?php if (!PMA_DRIZZLE): ?>
<th><a href="<?php echo $full_text_link; ?>"
title="<?php echo empty($full) ? __('Show Full Queries') : __('Truncate Shown Queries'); ?>">
<img src="<?php echo $pmaThemeImage . 's_' . (empty($_REQUEST['full']) ? 'full' : 'partial'); ?>text.png"
alt="<?php echo empty($_REQUEST['full']) ? __('Show Full Queries') : __('Truncate Shown Queries'); ?>" />
</a></th>
<?php else: ?>
<th></th>
<?php endif; ?>
<th><?php echo __('ID'); ?></th>
<th><?php echo __('User'); ?></th>
<th><?php echo __('Host'); ?></th>
<th><?php echo __('Database'); ?></th>
<th><?php echo __('Command'); ?></th>
<th><?php echo __('Time'); ?></th>
<th><?php echo __('Status'); ?></th>
<th><?php echo __('SQL query'); ?></th>
</tr>
</thead>
<tbody>
<?php
$odd_row = true;
while($process = PMA_DBI_fetch_assoc($result)) {
if (PMA_DRIZZLE) {
// Drizzle uses uppercase keys
foreach ($process as $k => $v) {
$k = $k !== 'DB'
? $k = ucfirst(strtolower($k))
: 'db';
$process[$k] = $v;
}
}
$url_params['kill'] = $process['Id'];
$kill_process = 'server_processlist.php' . PMA_generate_common_url($url_params);
?>
<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?>">
<td><a href="<?php echo $kill_process ; ?>"><?php echo __('Kill'); ?></a></td>
<td class="value"><?php echo $process['Id']; ?></td>
<td><?php echo $process['User']; ?></td>
<td><?php echo $process['Host']; ?></td>
<td><?php echo ((! isset($process['db']) || ! strlen($process['db'])) ? '<i>' . __('None') . '</i>' : $process['db']); ?></td>
<td><?php echo $process['Command']; ?></td>
<td class="value"><?php echo $process['Time']; ?></td>
<td><?php echo (empty($process['State']) ? '---' : $process['State']); ?></td>
<td><?php echo (empty($process['Info']) ? '---' : PMA_SQP_formatHtml(PMA_SQP_parse($process['Info']))); ?></td>
</tr>
<?php
$odd_row = ! $odd_row;
}
?>
</tbody>
</table>
<?php
/**
* Sends the footer
*/
require './libraries/footer.inc.php';
?>