Retrieve parameters from $_POST in server_status_variables.php
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
parent
89db84213b
commit
30543ad81f
@ -143,43 +143,44 @@ class Data
|
||||
$links = array();
|
||||
// variable or section name => (name => url)
|
||||
|
||||
$links['table'][__('Flush (close) all tables')] = $this->selfUrl
|
||||
. Url::getCommon(
|
||||
array(
|
||||
'flush' => 'TABLES'
|
||||
)
|
||||
);
|
||||
$links['table'][__('Show open tables')]
|
||||
= 'sql.php' . Url::getCommon(
|
||||
array(
|
||||
'sql_query' => 'SHOW OPEN TABLES',
|
||||
'goto' => $this->selfUrl,
|
||||
)
|
||||
);
|
||||
$links['table'][__('Flush (close) all tables')] = [
|
||||
'url' => $this->selfUrl,
|
||||
'params' => Url::getCommon(['flush' => 'TABLES'], ''),
|
||||
];
|
||||
$links['table'][__('Show open tables')] = [
|
||||
'url' => 'sql.php',
|
||||
'params' => Url::getCommon([
|
||||
'sql_query' => 'SHOW OPEN TABLES',
|
||||
'goto' => $this->selfUrl,
|
||||
], ''),
|
||||
];
|
||||
|
||||
if ($GLOBALS['replication_info']['master']['status']) {
|
||||
$links['repl'][__('Show slave hosts')]
|
||||
= 'sql.php' . Url::getCommon(
|
||||
array(
|
||||
'sql_query' => 'SHOW SLAVE HOSTS',
|
||||
'goto' => $this->selfUrl,
|
||||
)
|
||||
);
|
||||
$links['repl'][__('Show master status')] = '#replication_master';
|
||||
$links['repl'][__('Show slave hosts')] = [
|
||||
'url' => 'sql.php',
|
||||
'params' => Url::getCommon([
|
||||
'sql_query' => 'SHOW SLAVE HOSTS',
|
||||
'goto' => $this->selfUrl,
|
||||
], ''),
|
||||
];
|
||||
$links['repl'][__('Show master status')] = [
|
||||
'url' => '#replication_master',
|
||||
'params' => '',
|
||||
];
|
||||
}
|
||||
if ($GLOBALS['replication_info']['slave']['status']) {
|
||||
$links['repl'][__('Show slave status')] = '#replication_slave';
|
||||
$links['repl'][__('Show slave status')] = [
|
||||
'url' => '#replication_slave',
|
||||
'params' => '',
|
||||
];
|
||||
}
|
||||
|
||||
$links['repl']['doc'] = 'replication';
|
||||
|
||||
$links['qcache'][__('Flush query cache')]
|
||||
= $this->selfUrl
|
||||
. Url::getCommon(
|
||||
array(
|
||||
'flush' => 'QUERY CACHE'
|
||||
)
|
||||
);
|
||||
$links['qcache'][__('Flush query cache')] = [
|
||||
'url' => $this->selfUrl,
|
||||
'params' => Url::getCommon(['flush' => 'QUERY CACHE'], ''),
|
||||
];
|
||||
$links['qcache']['doc'] = 'query_cache';
|
||||
|
||||
$links['threads']['doc'] = 'mysql_threads';
|
||||
@ -190,16 +191,17 @@ class Data
|
||||
|
||||
$links['Slow_queries']['doc'] = 'slow_query_log';
|
||||
|
||||
$links['innodb'][__('Variables')]
|
||||
= 'server_engines.php?' . Url::getCommon(array('engine' => 'InnoDB'));
|
||||
$links['innodb'][__('InnoDB Status')]
|
||||
= 'server_engines.php'
|
||||
. Url::getCommon(
|
||||
array(
|
||||
'engine' => 'InnoDB',
|
||||
'page' => 'Status'
|
||||
)
|
||||
);
|
||||
$links['innodb'][__('Variables')] = [
|
||||
'url' => 'server_engines.php',
|
||||
'params' => Url::getCommon(['engine' => 'InnoDB'], ''),
|
||||
];
|
||||
$links['innodb'][__('InnoDB Status')] = [
|
||||
'url' => 'server_engines.php',
|
||||
'params' => Url::getCommon([
|
||||
'engine' => 'InnoDB',
|
||||
'page' => 'Status',
|
||||
], ''),
|
||||
];
|
||||
$links['innodb']['doc'] = 'innodb';
|
||||
|
||||
return($links);
|
||||
|
||||
@ -30,23 +30,23 @@ class Variables
|
||||
public static function getHtmlForFilter(Data $serverStatusData)
|
||||
{
|
||||
$filterAlert = '';
|
||||
if (! empty($_REQUEST['filterAlert'])) {
|
||||
if (! empty($_POST['filterAlert'])) {
|
||||
$filterAlert = ' checked="checked"';
|
||||
}
|
||||
$filterText = '';
|
||||
if (! empty($_REQUEST['filterText'])) {
|
||||
$filterText = htmlspecialchars($_REQUEST['filterText']);
|
||||
if (! empty($_POST['filterText'])) {
|
||||
$filterText = htmlspecialchars($_POST['filterText']);
|
||||
}
|
||||
$dontFormat = '';
|
||||
if (! empty($_REQUEST['dontFormat'])) {
|
||||
if (! empty($_POST['dontFormat'])) {
|
||||
$dontFormat = ' checked="checked"';
|
||||
}
|
||||
|
||||
$retval = '';
|
||||
$retval .= '<fieldset id="tableFilter">';
|
||||
$retval .= '<legend>' . __('Filters') . '</legend>';
|
||||
$retval .= '<form action="server_status_variables.php'
|
||||
. Url::getCommon() . '">';
|
||||
$retval .= '<form action="server_status_variables.php" method="post">';
|
||||
$retval .= Url::getHiddenInputs();
|
||||
$retval .= '<input type="submit" value="' . __('Refresh') . '" />';
|
||||
$retval .= '<div class="formelement">';
|
||||
$retval .= '<label for="filterText">' . __('Containing the word:') . '</label>';
|
||||
@ -66,8 +66,8 @@ class Variables
|
||||
|
||||
foreach ($serverStatusData->sections as $section_id => $section_name) {
|
||||
if (isset($serverStatusData->sectionUsed[$section_id])) {
|
||||
if (! empty($_REQUEST['filterCategory'])
|
||||
&& $_REQUEST['filterCategory'] == $section_id
|
||||
if (! empty($_POST['filterCategory'])
|
||||
&& $_POST['filterCategory'] == $section_id
|
||||
) {
|
||||
$selected = ' selected="selected"';
|
||||
} else {
|
||||
@ -113,7 +113,8 @@ class Variables
|
||||
if ('doc' == $link_name) {
|
||||
$retval .= Util::showMySQLDocu($link_url);
|
||||
} else {
|
||||
$retval .= '<a href="' . $link_url . '">' . $link_name . '</a>';
|
||||
$retval .= '<a href="' . $link_url['url'] . '" data-post="' . $link_url['params'] . '">'
|
||||
. $link_name . '</a>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -309,7 +310,8 @@ class Variables
|
||||
if ('doc' == $link_name) {
|
||||
$retval .= Util::showMySQLDocu($link_url);
|
||||
} else {
|
||||
$retval .= ' <a href="' . $link_url . '">' . $link_name . '</a>';
|
||||
$retval .= ' <a href="' . $link_url['url'] . '" data-post="' . $link_url['params'] . '">'
|
||||
. $link_name . '</a>';
|
||||
}
|
||||
}
|
||||
unset($link_url, $link_name);
|
||||
|
||||
@ -18,15 +18,15 @@ require_once 'libraries/replication.inc.php';
|
||||
/**
|
||||
* flush status variables if requested
|
||||
*/
|
||||
if (isset($_REQUEST['flush'])) {
|
||||
if (isset($_POST['flush'])) {
|
||||
$_flush_commands = array(
|
||||
'STATUS',
|
||||
'TABLES',
|
||||
'QUERY CACHE',
|
||||
);
|
||||
|
||||
if (in_array($_REQUEST['flush'], $_flush_commands)) {
|
||||
$GLOBALS['dbi']->query('FLUSH ' . $_REQUEST['flush'] . ';');
|
||||
if (in_array($_POST['flush'], $_flush_commands)) {
|
||||
$GLOBALS['dbi']->query('FLUSH ' . $_POST['flush'] . ';');
|
||||
}
|
||||
unset($_flush_commands);
|
||||
}
|
||||
|
||||
@ -35,10 +35,6 @@ class VariablesTest extends TestCase
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
//$_REQUEST
|
||||
$_REQUEST['log'] = "index1";
|
||||
$_REQUEST['pos'] = 3;
|
||||
|
||||
//$GLOBALS
|
||||
$GLOBALS['cfg']['MaxRows'] = 10;
|
||||
$GLOBALS['cfg']['ServerDefault'] = "server";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user