refactored: use $_REQUEST, remember full text display when killing process, removed unneeded h1, use PMA_generate_common_url()

This commit is contained in:
Sebastian Mendel
2008-01-18 13:43:00 +00:00
parent cb89bd27a6
commit 087fac8291

View File

@@ -9,60 +9,45 @@
* *
*/ */
require_once './libraries/common.inc.php'; require_once './libraries/common.inc.php';
/**
* Does the common work
*/
require_once './libraries/server_common.inc.php'; require_once './libraries/server_common.inc.php';
require './libraries/server_links.inc.php';
/** /**
* Kills a selected process * Kills a selected process
*/ */
if (!empty($kill)) { if (!empty($_REQUEST['kill'])) {
if (PMA_DBI_try_query('KILL ' . $kill . ';')) { if (PMA_DBI_try_query('KILL ' . $_REQUEST['kill'] . ';')) {
$message = PMA_Message::success('strThreadSuccessfullyKilled'); $message = PMA_Message::success('strThreadSuccessfullyKilled');
} else { } else {
$message = PMA_Message::error('strCouldNotKill'); $message = PMA_Message::error('strCouldNotKill');
} }
$message->addParam($kill); $message->addParam($_REQUEST['kill']);
$message->display();
} }
$url_params = array();
/** if (! empty($_REQUEST['full'])) {
* Displays the links $sql_query = 'SHOW FULL PROCESSLIST';
*/ $url_params['full'] = 1;
require './libraries/server_links.inc.php'; $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));
* Displays the sub-page heading }
*/
echo '<h2>' . "\n"
. ($cfg['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_process.png" width="16" height="16" alt="" />' : '')
. $strProcesslist . "\n"
. '</h2>' . "\n";
/**
* Sends the query
*/
$sql_query = 'SHOW' . (empty($full) ? '' : ' FULL') . ' PROCESSLIST';
$result = PMA_DBI_query($sql_query); $result = PMA_DBI_query($sql_query);
PMA_Message::success()->display();
/** /**
* Displays the page * Displays the page
*/ */
?> ?>
<table id="tableprocesslist" class="data"> <table id="tableprocesslist" class="data">
<thead> <thead>
<tr><td><a href="./server_processlist.php?<?php echo $url_query . (empty($full) ? '&amp;full=1' : ''); ?>" <tr><td><a href="<?php echo $full_text_link; ?>"
title="<?php echo empty($full) ? $strShowFullQueries : $strTruncateQueries; ?>"> title="<?php echo empty($full) ? $strShowFullQueries : $strTruncateQueries; ?>">
<img src="<?php echo $pmaThemeImage . 's_' . (empty($full) ? 'full' : 'partial'); ?>text.png" <img src="<?php echo $pmaThemeImage . 's_' . (empty($_REQUEST['full']) ? 'full' : 'partial'); ?>text.png"
width="50" height="20" alt="<?php echo empty($full) ? $strShowFullQueries : $strTruncateQueries; ?>" /> width="50" height="20" alt="<?php echo empty($_REQUEST['full']) ? $strShowFullQueries : $strTruncateQueries; ?>" />
</a></td> </a></td>
<th><?php echo $strId; ?></th> <th><?php echo $strId; ?></th>
<th><?php echo $strUser; ?></th> <th><?php echo $strUser; ?></th>
@@ -78,9 +63,11 @@ PMA_Message::success()->display();
<?php <?php
$odd_row = true; $odd_row = true;
while($process = PMA_DBI_fetch_assoc($result)) { while($process = PMA_DBI_fetch_assoc($result)) {
$url_params['kill'] = $process['Id'];
$kill_process = 'server_processlist.php' . PMA_generate_common_url($url_params);
?> ?>
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>"> <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
<td><a href="./server_processlist.php?<?php echo $url_query . '&amp;kill=' . $process['Id']; ?>"><?php echo $strKill; ?></a></td> <td><a href="<?php echo $kill_process ; ?>"><?php echo $strKill; ?></a></td>
<td class="value"><?php echo $process['Id']; ?></td> <td class="value"><?php echo $process['Id']; ?></td>
<td><?php echo $process['User']; ?></td> <td><?php echo $process['User']; ?></td>
<td><?php echo $process['Host']; ?></td> <td><?php echo $process['Host']; ?></td>