Merge branch 'QA_3_3'
[phpmyadmin-regexreplace.git] / server_processlist.php
blobea31a7617a6b4bb1f6451ed442b550b7ca897b96
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 * Displays the sub-page heading
19 echo '<h2>' . "\n"
20 . ($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $pmaThemeImage . 's_process.png" width="16" height="16" border="0" hspace="2" align="middle" alt="" />' : '')
21 . ' ' . __('Processes') . "\n"
22 . '</h2>' . "\n";
24 /**
25 * Kills a selected process
27 if (!empty($_REQUEST['kill'])) {
28 if (PMA_DBI_try_query('KILL ' . $_REQUEST['kill'] . ';')) {
29 $message = PMA_Message::success(__('Thread %s was successfully killed.'));
30 } else {
31 $message = PMA_Message::error(__('phpMyAdmin was unable to kill thread %s. It probably has already been closed.'));
33 $message->addParam($_REQUEST['kill']);
34 $message->display();
37 $url_params = array();
39 if (! empty($_REQUEST['full'])) {
40 $sql_query = 'SHOW FULL PROCESSLIST';
41 $url_params['full'] = 1;
42 $full_text_link = 'server_processlist.php' . PMA_generate_common_url(array(), 'html', '?');
43 } else {
44 $sql_query = 'SHOW PROCESSLIST';
45 $full_text_link = 'server_processlist.php' . PMA_generate_common_url(array('full' => 1));
47 $result = PMA_DBI_query($sql_query);
49 /**
50 * Displays the page
53 <table id="tableprocesslist" class="data">
54 <thead>
55 <tr><td><a href="<?php echo $full_text_link; ?>"
56 title="<?php echo empty($full) ? __('Show Full Queries') : __('Truncate Shown Queries'); ?>">
57 <img src="<?php echo $pmaThemeImage . 's_' . (empty($_REQUEST['full']) ? 'full' : 'partial'); ?>text.png"
58 alt="<?php echo empty($_REQUEST['full']) ? __('Show Full Queries') : __('Truncate Shown Queries'); ?>" />
59 </a></td>
60 <th><?php echo __('ID'); ?></th>
61 <th><?php echo __('User'); ?></th>
62 <th><?php echo __('Host'); ?></th>
63 <th><?php echo __('Database'); ?></th>
64 <th><?php echo __('Command'); ?></th>
65 <th><?php echo __('Time'); ?></th>
66 <th><?php echo __('Status'); ?></th>
67 <th><?php echo __('SQL query'); ?></th>
68 </tr>
69 </thead>
70 <tbody>
71 <?php
72 $odd_row = true;
73 while($process = PMA_DBI_fetch_assoc($result)) {
74 $url_params['kill'] = $process['Id'];
75 $kill_process = 'server_processlist.php' . PMA_generate_common_url($url_params);
77 <tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?>">
78 <td><a href="<?php echo $kill_process ; ?>"><?php echo __('Kill'); ?></a></td>
79 <td class="value"><?php echo $process['Id']; ?></td>
80 <td><?php echo $process['User']; ?></td>
81 <td><?php echo $process['Host']; ?></td>
82 <td><?php echo ((! isset($process['db']) || ! strlen($process['db'])) ? '<i>' . __('None') . '</i>' : $process['db']); ?></td>
83 <td><?php echo $process['Command']; ?></td>
84 <td class="value"><?php echo $process['Time']; ?></td>
85 <td><?php echo (empty($process['State']) ? '---' : $process['State']); ?></td>
86 <td><?php echo (empty($process['Info']) ? '---' : PMA_SQP_formatHtml(PMA_SQP_parse($process['Info']))); ?></td>
87 </tr>
88 <?php
89 $odd_row = ! $odd_row;
92 </tbody>
93 </table>
94 <?php
96 /**
97 * Sends the footer
99 require './libraries/footer.inc.php';