Merge branch 'QA_3_3'
[phpmyadmin/dkf.git] / server_processlist.php
blobed60d77f7562301283c764d0763d18c695b7b697
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
9 /**
12 require_once './libraries/common.inc.php';
13 require_once './libraries/server_common.inc.php';
14 require './libraries/server_links.inc.php';
17 /**
18 * Kills a selected process
20 if (!empty($_REQUEST['kill'])) {
21 if (PMA_DBI_try_query('KILL ' . $_REQUEST['kill'] . ';')) {
22 $message = PMA_Message::success('strThreadSuccessfullyKilled');
23 } else {
24 $message = PMA_Message::error('strCouldNotKill');
26 $message->addParam($_REQUEST['kill']);
27 $message->display();
30 $url_params = array();
32 if (! empty($_REQUEST['full'])) {
33 $sql_query = 'SHOW FULL PROCESSLIST';
34 $url_params['full'] = 1;
35 $full_text_link = 'server_processlist.php' . PMA_generate_common_url(array(), 'html', '?');
36 } else {
37 $sql_query = 'SHOW PROCESSLIST';
38 $full_text_link = 'server_processlist.php' . PMA_generate_common_url(array('full' => 1));
40 $result = PMA_DBI_query($sql_query);
42 /**
43 * Displays the page
46 <table id="tableprocesslist" class="data">
47 <thead>
48 <tr><td><a href="<?php echo $full_text_link; ?>"
49 title="<?php echo empty($full) ? __('Show Full Queries') : __('Truncate Shown Queries'); ?>">
50 <img src="<?php echo $pmaThemeImage . 's_' . (empty($_REQUEST['full']) ? 'full' : 'partial'); ?>text.png"
51 width="50" height="20" alt="<?php echo empty($_REQUEST['full']) ? __('Show Full Queries') : __('Truncate Shown Queries'); ?>" />
52 </a></td>
53 <th><?php echo __('ID'); ?></th>
54 <th><?php echo __('User'); ?></th>
55 <th><?php echo __('Host'); ?></th>
56 <th><?php echo __('Database'); ?></th>
57 <th><?php echo __('Command'); ?></th>
58 <th><?php echo __('Time'); ?></th>
59 <th><?php echo __('Status'); ?></th>
60 <th><?php echo __('SQL query'); ?></th>
61 </tr>
62 </thead>
63 <tbody>
64 <?php
65 $odd_row = true;
66 while($process = PMA_DBI_fetch_assoc($result)) {
67 $url_params['kill'] = $process['Id'];
68 $kill_process = 'server_processlist.php' . PMA_generate_common_url($url_params);
70 <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
71 <td><a href="<?php echo $kill_process ; ?>"><?php echo __('Kill'); ?></a></td>
72 <td class="value"><?php echo $process['Id']; ?></td>
73 <td><?php echo $process['User']; ?></td>
74 <td><?php echo $process['Host']; ?></td>
75 <td><?php echo ((! isset($process['db']) || ! strlen($process['db'])) ? '<i>' . __('None') . '</i>' : $process['db']); ?></td>
76 <td><?php echo $process['Command']; ?></td>
77 <td class="value"><?php echo $process['Time']; ?></td>
78 <td><?php echo (empty($process['State']) ? '---' : $process['State']); ?></td>
79 <td><?php echo (empty($process['Info']) ? '---' : PMA_SQP_formatHtml(PMA_SQP_parse($process['Info']))); ?></td>
80 </tr>
81 <?php
82 $odd_row = ! $odd_row;
85 </tbody>
86 </table>
87 <?php
89 /**
90 * Sends the footer
92 require_once './libraries/footer.inc.php';