Merge remote branch 'origin/master'
[phpmyadmin/dkf.git] / server_processlist.php
blob337d917d39802502c6672b3574dfff764e172d57
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package phpMyAdmin
6 */
8 /**
11 require_once './libraries/common.inc.php';
12 require_once './libraries/server_common.inc.php';
13 require './libraries/server_links.inc.php';
16 /**
17 * Kills a selected process
19 if (!empty($_REQUEST['kill'])) {
20 if (PMA_DBI_try_query('KILL ' . $_REQUEST['kill'] . ';')) {
21 $message = PMA_Message::success(__('Thread %s was successfully killed.'));
22 } else {
23 $message = PMA_Message::error(__('phpMyAdmin was unable to kill thread %s. It probably has already been closed.'));
25 $message->addParam($_REQUEST['kill']);
26 $message->display();
29 $url_params = array();
31 if (! empty($_REQUEST['full'])) {
32 $sql_query = 'SHOW FULL PROCESSLIST';
33 $url_params['full'] = 1;
34 $full_text_link = 'server_processlist.php' . PMA_generate_common_url(array(), 'html', '?');
35 } else {
36 $sql_query = 'SHOW PROCESSLIST';
37 $full_text_link = 'server_processlist.php' . PMA_generate_common_url(array('full' => 1));
39 $result = PMA_DBI_query($sql_query);
41 /**
42 * Displays the page
45 <table id="tableprocesslist" class="data">
46 <thead>
47 <tr><td><a href="<?php echo $full_text_link; ?>"
48 title="<?php echo empty($full) ? __('Show Full Queries') : __('Truncate Shown Queries'); ?>">
49 <img src="<?php echo $pmaThemeImage . 's_' . (empty($_REQUEST['full']) ? 'full' : 'partial'); ?>text.png"
50 width="50" height="20" alt="<?php echo empty($_REQUEST['full']) ? __('Show Full Queries') : __('Truncate Shown Queries'); ?>" />
51 </a></td>
52 <th><?php echo __('ID'); ?></th>
53 <th><?php echo __('User'); ?></th>
54 <th><?php echo __('Host'); ?></th>
55 <th><?php echo __('Database'); ?></th>
56 <th><?php echo __('Command'); ?></th>
57 <th><?php echo __('Time'); ?></th>
58 <th><?php echo __('Status'); ?></th>
59 <th><?php echo __('SQL query'); ?></th>
60 </tr>
61 </thead>
62 <tbody>
63 <?php
64 $odd_row = true;
65 while($process = PMA_DBI_fetch_assoc($result)) {
66 $url_params['kill'] = $process['Id'];
67 $kill_process = 'server_processlist.php' . PMA_generate_common_url($url_params);
69 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
70 <td><a href="<?php echo $kill_process ; ?>"><?php echo __('Kill'); ?></a></td>
71 <td class="value"><?php echo $process['Id']; ?></td>
72 <td><?php echo $process['User']; ?></td>
73 <td><?php echo $process['Host']; ?></td>
74 <td><?php echo ((! isset($process['db']) || ! strlen($process['db'])) ? '<i>' . __('None') . '</i>' : $process['db']); ?></td>
75 <td><?php echo $process['Command']; ?></td>
76 <td class="value"><?php echo $process['Time']; ?></td>
77 <td><?php echo (empty($process['State']) ? '---' : $process['State']); ?></td>
78 <td><?php echo (empty($process['Info']) ? '---' : PMA_SQP_formatHtml(PMA_SQP_parse($process['Info']))); ?></td>
79 </tr>
80 <?php
81 $odd_row = ! $odd_row;
84 </tbody>
85 </table>
86 <?php
88 /**
89 * Sends the footer
91 require './libraries/footer.inc.php';