fix the issues:
1. replace tab with space in server_bin_log.lib.php 2. move $bin_log to server_binlog.php 3. add server common function file server_common.lib.php
This commit is contained in:
parent
fc3e0d961e
commit
bfb6dec7e6
@ -23,48 +23,48 @@ if (! defined('PHPMYADMIN')) {
|
||||
*/
|
||||
function PMA_getLogSelector($binary_log_file_names, $url_params)
|
||||
{
|
||||
$html = "";
|
||||
if (count($binary_log_file_names) > 1) {
|
||||
$html .= '<form action="server_binlog.php" method="get">';
|
||||
$html .= PMA_generate_common_hidden_inputs($url_params);
|
||||
$html .= '<fieldset><legend>';
|
||||
$html .= __('Select binary log to view');
|
||||
$html .= '</legend><select name="log">';
|
||||
$full_size = 0;
|
||||
foreach ($binary_log_file_names as $each_log) {
|
||||
$html .= '<option value="' . $each_log['Log_name'] . '"';
|
||||
if ($each_log['Log_name'] == $_REQUEST['log']) {
|
||||
$html .= ' selected="selected"';
|
||||
}
|
||||
$html .= '>' . $each_log['Log_name'];
|
||||
if (isset($each_log['File_size'])) {
|
||||
$full_size += $each_log['File_size'];
|
||||
$html .= ' ('
|
||||
. implode(
|
||||
' ',
|
||||
PMA_Util::formatByteDown(
|
||||
$each_log['File_size'], 3, 2
|
||||
)
|
||||
)
|
||||
. ')';
|
||||
}
|
||||
$html .= '</option>';
|
||||
}
|
||||
$html .= '</select> ';
|
||||
$html .= count($binary_log_file_names) . ' ' . __('Files') . ', ';
|
||||
if ($full_size > 0) {
|
||||
$html .= implode(
|
||||
' ', PMA_Util::formatByteDown($full_size)
|
||||
);
|
||||
}
|
||||
$html .= '</fieldset>';
|
||||
$html .= '<fieldset class="tblFooters">';
|
||||
$html .= '<input type="submit" value="' . __('Go') . '" />';
|
||||
$html .= '</fieldset>';
|
||||
$html .= '</form>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
$html = "";
|
||||
if (count($binary_log_file_names) > 1) {
|
||||
$html .= '<form action="server_binlog.php" method="get">';
|
||||
$html .= PMA_generate_common_hidden_inputs($url_params);
|
||||
$html .= '<fieldset><legend>';
|
||||
$html .= __('Select binary log to view');
|
||||
$html .= '</legend><select name="log">';
|
||||
$full_size = 0;
|
||||
foreach ($binary_log_file_names as $each_log) {
|
||||
$html .= '<option value="' . $each_log['Log_name'] . '"';
|
||||
if ($each_log['Log_name'] == $_REQUEST['log']) {
|
||||
$html .= ' selected="selected"';
|
||||
}
|
||||
$html .= '>' . $each_log['Log_name'];
|
||||
if (isset($each_log['File_size'])) {
|
||||
$full_size += $each_log['File_size'];
|
||||
$html .= ' ('
|
||||
. implode(
|
||||
' ',
|
||||
PMA_Util::formatByteDown(
|
||||
$each_log['File_size'], 3, 2
|
||||
)
|
||||
)
|
||||
. ')';
|
||||
}
|
||||
$html .= '</option>';
|
||||
}
|
||||
$html .= '</select> ';
|
||||
$html .= count($binary_log_file_names) . ' ' . __('Files') . ', ';
|
||||
if ($full_size > 0) {
|
||||
$html .= implode(
|
||||
' ', PMA_Util::formatByteDown($full_size)
|
||||
);
|
||||
}
|
||||
$html .= '</fieldset>';
|
||||
$html .= '<fieldset class="tblFooters">';
|
||||
$html .= '<input type="submit" value="' . __('Go') . '" />';
|
||||
$html .= '</fieldset>';
|
||||
$html .= '</form>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,74 +78,74 @@ function PMA_getLogSelector($binary_log_file_names, $url_params)
|
||||
*/
|
||||
function PMA_getLogInfo($binary_log_file_names, $url_params)
|
||||
{
|
||||
/**
|
||||
* Need to find the real end of rows?
|
||||
*/
|
||||
if (! isset($_REQUEST['pos'])) {
|
||||
$pos = 0;
|
||||
} else {
|
||||
/* We need this to be a integer */
|
||||
$pos = (int) $_REQUEST['pos'];
|
||||
}
|
||||
|
||||
$sql_query = 'SHOW BINLOG EVENTS';
|
||||
if (! empty($_REQUEST['log'])) {
|
||||
$sql_query .= ' IN \'' . $_REQUEST['log'] . '\'';
|
||||
}
|
||||
if ($GLOBALS['cfg']['MaxRows'] !== 'all') {
|
||||
$sql_query .= ' LIMIT ' . $pos . ', ' . (int) $GLOBALS['cfg']['MaxRows'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the query
|
||||
*/
|
||||
$result = $GLOBALS['dbi']->query($sql_query);
|
||||
|
||||
/**
|
||||
* prepare some vars for displaying the result table
|
||||
*/
|
||||
// Gets the list of fields properties
|
||||
if (isset($result) && $result) {
|
||||
$num_rows = $GLOBALS['dbi']->numRows($result);
|
||||
} else {
|
||||
$num_rows = 0;
|
||||
}
|
||||
|
||||
if (empty($_REQUEST['dontlimitchars'])) {
|
||||
$dontlimitchars = false;
|
||||
} else {
|
||||
$dontlimitchars = true;
|
||||
$url_params['dontlimitchars'] = 1;
|
||||
}
|
||||
/**
|
||||
* Need to find the real end of rows?
|
||||
*/
|
||||
if (! isset($_REQUEST['pos'])) {
|
||||
$pos = 0;
|
||||
} else {
|
||||
/* We need this to be a integer */
|
||||
$pos = (int) $_REQUEST['pos'];
|
||||
}
|
||||
|
||||
$sql_query = 'SHOW BINLOG EVENTS';
|
||||
if (! empty($_REQUEST['log'])) {
|
||||
$sql_query .= ' IN \'' . $_REQUEST['log'] . '\'';
|
||||
}
|
||||
if ($GLOBALS['cfg']['MaxRows'] !== 'all') {
|
||||
$sql_query .= ' LIMIT ' . $pos . ', ' . (int) $GLOBALS['cfg']['MaxRows'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the query
|
||||
*/
|
||||
$result = $GLOBALS['dbi']->query($sql_query);
|
||||
|
||||
/**
|
||||
* prepare some vars for displaying the result table
|
||||
*/
|
||||
// Gets the list of fields properties
|
||||
if (isset($result) && $result) {
|
||||
$num_rows = $GLOBALS['dbi']->numRows($result);
|
||||
} else {
|
||||
$num_rows = 0;
|
||||
}
|
||||
|
||||
if (empty($_REQUEST['dontlimitchars'])) {
|
||||
$dontlimitchars = false;
|
||||
} else {
|
||||
$dontlimitchars = true;
|
||||
$url_params['dontlimitchars'] = 1;
|
||||
}
|
||||
|
||||
//html output
|
||||
$html = PMA_Util::getMessage(PMA_Message::success(), $sql_query);
|
||||
$html .= '<table cellpadding="2" cellspacing="1" id="binlogTable">'
|
||||
. '<thead>'
|
||||
. '<tr>'
|
||||
. '<td colspan="6" class="center">';
|
||||
|
||||
$html .= PMA_getNavigationRow($url_params, $pos, $num_rows, $dontlimitchars);
|
||||
|
||||
$html .= '</td>'
|
||||
. '</tr>'
|
||||
. '<tr>'
|
||||
. '<th>' . __('Log name') . '</th>'
|
||||
. '<th>' . __('Position') . '</th>'
|
||||
. '<th>' . __('Event type') . '</th>'
|
||||
. '<th>' . __('Server ID') . '</th>'
|
||||
. '<th>' . __('Original position') . '</th>'
|
||||
. '<th>' . __('Information') . '</th>'
|
||||
. '</tr>'
|
||||
. '</thead>'
|
||||
. '<tbody>';
|
||||
|
||||
$html .= PMA_getAllLogItemInfo($result, $dontlimitchars);
|
||||
|
||||
$html .= '</tbody>'
|
||||
. '</table>';
|
||||
|
||||
return $html;
|
||||
//html output
|
||||
$html = PMA_Util::getMessage(PMA_Message::success(), $sql_query);
|
||||
$html .= '<table cellpadding="2" cellspacing="1" id="binlogTable">'
|
||||
. '<thead>'
|
||||
. '<tr>'
|
||||
. '<td colspan="6" class="center">';
|
||||
|
||||
$html .= PMA_getNavigationRow($url_params, $pos, $num_rows, $dontlimitchars);
|
||||
|
||||
$html .= '</td>'
|
||||
. '</tr>'
|
||||
. '<tr>'
|
||||
. '<th>' . __('Log name') . '</th>'
|
||||
. '<th>' . __('Position') . '</th>'
|
||||
. '<th>' . __('Event type') . '</th>'
|
||||
. '<th>' . __('Server ID') . '</th>'
|
||||
. '<th>' . __('Original position') . '</th>'
|
||||
. '<th>' . __('Information') . '</th>'
|
||||
. '</tr>'
|
||||
. '</thead>'
|
||||
. '<tbody>';
|
||||
|
||||
$html .= PMA_getAllLogItemInfo($result, $dontlimitchars);
|
||||
|
||||
$html .= '</tbody>'
|
||||
. '</table>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,60 +163,60 @@ function PMA_getLogInfo($binary_log_file_names, $url_params)
|
||||
*/
|
||||
function PMA_getNavigationRow($url_params, $pos, $num_rows, $dontlimitchars)
|
||||
{
|
||||
$html = "";
|
||||
// we do not know how much rows are in the binlog
|
||||
// so we can just force 'NEXT' button
|
||||
if ($pos > 0) {
|
||||
$this_url_params = $url_params;
|
||||
if ($pos > $GLOBALS['cfg']['MaxRows']) {
|
||||
$this_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxRows'];
|
||||
}
|
||||
|
||||
$html .= '<a href="server_binlog.php'
|
||||
. PMA_generate_common_url($this_url_params) . '"';
|
||||
if ($GLOBALS['cfg']['NavigationBarIconic']) {
|
||||
$html .= ' title="' . _pgettext('Previous page', 'Previous') . '">';
|
||||
} else {
|
||||
$html .= '>' . _pgettext('Previous page', 'Previous');
|
||||
} // end if... else...
|
||||
$html .= ' < </a> - ';
|
||||
}
|
||||
|
||||
$this_url_params = $url_params;
|
||||
if ($pos > 0) {
|
||||
$this_url_params['pos'] = $pos;
|
||||
}
|
||||
if ($dontlimitchars) {
|
||||
unset($this_url_params['dontlimitchars']);
|
||||
$tempTitle = __('Truncate Shown Queries');
|
||||
$tempImgMode = 'partial';
|
||||
} else {
|
||||
$this_url_params['dontlimitchars'] = 1;
|
||||
$tempTitle = __('Show Full Queries');
|
||||
$tempImgMode = 'full';
|
||||
}
|
||||
$html .= '<a href="server_binlog.php' . PMA_generate_common_url($this_url_params)
|
||||
. '" title="' . $tempTitle . '">'
|
||||
. '<img src="' .$GLOBALS['pmaThemeImage'] . 's_' . $tempImgMode . 'text.png"'
|
||||
. 'alt="' . $tempTitle . '" /></a>';
|
||||
|
||||
// we do not now how much rows are in the binlog
|
||||
// so we can just force 'NEXT' button
|
||||
if ($num_rows >= $GLOBALS['cfg']['MaxRows']) {
|
||||
$this_url_params = $url_params;
|
||||
$this_url_params['pos'] = $pos + $GLOBALS['cfg']['MaxRows'];
|
||||
$html .= ' - <a href="server_binlog.php'
|
||||
. PMA_generate_common_url($this_url_params)
|
||||
. '"';
|
||||
if ($GLOBALS['cfg']['NavigationBarIconic']) {
|
||||
$html .= ' title="' . _pgettext('Next page', 'Next') . '">';
|
||||
} else {
|
||||
$html .= '>' . _pgettext('Next page', 'Next');
|
||||
} // end if... else...
|
||||
$html .= ' > </a>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
$html = "";
|
||||
// we do not know how much rows are in the binlog
|
||||
// so we can just force 'NEXT' button
|
||||
if ($pos > 0) {
|
||||
$this_url_params = $url_params;
|
||||
if ($pos > $GLOBALS['cfg']['MaxRows']) {
|
||||
$this_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxRows'];
|
||||
}
|
||||
|
||||
$html .= '<a href="server_binlog.php'
|
||||
. PMA_generate_common_url($this_url_params) . '"';
|
||||
if ($GLOBALS['cfg']['NavigationBarIconic']) {
|
||||
$html .= ' title="' . _pgettext('Previous page', 'Previous') . '">';
|
||||
} else {
|
||||
$html .= '>' . _pgettext('Previous page', 'Previous');
|
||||
} // end if... else...
|
||||
$html .= ' < </a> - ';
|
||||
}
|
||||
|
||||
$this_url_params = $url_params;
|
||||
if ($pos > 0) {
|
||||
$this_url_params['pos'] = $pos;
|
||||
}
|
||||
if ($dontlimitchars) {
|
||||
unset($this_url_params['dontlimitchars']);
|
||||
$tempTitle = __('Truncate Shown Queries');
|
||||
$tempImgMode = 'partial';
|
||||
} else {
|
||||
$this_url_params['dontlimitchars'] = 1;
|
||||
$tempTitle = __('Show Full Queries');
|
||||
$tempImgMode = 'full';
|
||||
}
|
||||
$html .= '<a href="server_binlog.php' . PMA_generate_common_url($this_url_params)
|
||||
. '" title="' . $tempTitle . '">'
|
||||
. '<img src="' .$GLOBALS['pmaThemeImage'] . 's_' . $tempImgMode . 'text.png"'
|
||||
. 'alt="' . $tempTitle . '" /></a>';
|
||||
|
||||
// we do not now how much rows are in the binlog
|
||||
// so we can just force 'NEXT' button
|
||||
if ($num_rows >= $GLOBALS['cfg']['MaxRows']) {
|
||||
$this_url_params = $url_params;
|
||||
$this_url_params['pos'] = $pos + $GLOBALS['cfg']['MaxRows'];
|
||||
$html .= ' - <a href="server_binlog.php'
|
||||
. PMA_generate_common_url($this_url_params)
|
||||
. '"';
|
||||
if ($GLOBALS['cfg']['NavigationBarIconic']) {
|
||||
$html .= ' title="' . _pgettext('Next page', 'Next') . '">';
|
||||
} else {
|
||||
$html .= '>' . _pgettext('Next page', 'Next');
|
||||
} // end if... else...
|
||||
$html .= ' > </a>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -230,33 +230,33 @@ function PMA_getNavigationRow($url_params, $pos, $num_rows, $dontlimitchars)
|
||||
*/
|
||||
function PMA_getAllLogItemInfo($result, $dontlimitchars)
|
||||
{
|
||||
$html = "";
|
||||
$odd_row = true;
|
||||
while ($value = $GLOBALS['dbi']->fetchAssoc($result)) {
|
||||
if (! $dontlimitchars
|
||||
&& PMA_strlen($value['Info']) > $GLOBALS['cfg']['LimitChars']
|
||||
) {
|
||||
$value['Info'] = PMA_substr(
|
||||
$value['Info'], 0, $GLOBALS['cfg']['LimitChars']
|
||||
) . '...';
|
||||
}
|
||||
|
||||
$html .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">'
|
||||
. '<td> ' . $value['Log_name'] . ' </td>'
|
||||
. '<td class="right"> ' . $value['Pos'] . ' </td>'
|
||||
. '<td> ' . $value['Event_type'] . ' </td>'
|
||||
. '<td class="right"> ' . $value['Server_id'] . ' </td>'
|
||||
. '<td class="right"> '
|
||||
. (isset($value['Orig_log_pos'])
|
||||
? $value['Orig_log_pos'] : $value['End_log_pos'])
|
||||
. ' </td>'
|
||||
. '<td><code class="sql"><pre> ' . htmlspecialchars($value['Info'])
|
||||
. ' </pre></code></td>'
|
||||
. '</tr>';
|
||||
|
||||
$odd_row = !$odd_row;
|
||||
}
|
||||
return $html;
|
||||
$html = "";
|
||||
$odd_row = true;
|
||||
while ($value = $GLOBALS['dbi']->fetchAssoc($result)) {
|
||||
if (! $dontlimitchars
|
||||
&& PMA_strlen($value['Info']) > $GLOBALS['cfg']['LimitChars']
|
||||
) {
|
||||
$value['Info'] = PMA_substr(
|
||||
$value['Info'], 0, $GLOBALS['cfg']['LimitChars']
|
||||
) . '...';
|
||||
}
|
||||
|
||||
$html .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">'
|
||||
. '<td> ' . $value['Log_name'] . ' </td>'
|
||||
. '<td class="right"> ' . $value['Pos'] . ' </td>'
|
||||
. '<td> ' . $value['Event_type'] . ' </td>'
|
||||
. '<td class="right"> ' . $value['Server_id'] . ' </td>'
|
||||
. '<td class="right"> '
|
||||
. (isset($value['Orig_log_pos'])
|
||||
? $value['Orig_log_pos'] : $value['End_log_pos'])
|
||||
. ' </td>'
|
||||
. '<td><code class="sql"><pre> ' . htmlspecialchars($value['Info'])
|
||||
. ' </pre></code></td>'
|
||||
. '</tr>';
|
||||
|
||||
$odd_row = !$odd_row;
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -39,44 +39,13 @@ if ($is_superuser && ! PMA_DRIZZLE) {
|
||||
$GLOBALS['dbi']->selectDb('mysql', $userlink);
|
||||
}
|
||||
|
||||
/**
|
||||
* @global array binary log files
|
||||
*/
|
||||
$binary_logs = PMA_DRIZZLE
|
||||
? null
|
||||
: $GLOBALS['dbi']->fetchResult(
|
||||
'SHOW MASTER LOGS',
|
||||
'Log_name',
|
||||
null,
|
||||
null,
|
||||
PMA_DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
PMA_Util::checkParameters(
|
||||
array('is_superuser', 'url_query'), false
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the html for the sub-page heading
|
||||
*
|
||||
* @param string $type Sub page type
|
||||
*
|
||||
* @return string
|
||||
* shared functions for server page
|
||||
*/
|
||||
function PMA_getSubPageHeader($type)
|
||||
{
|
||||
$res = array();
|
||||
require_once './libraries/server_common.lib.php';
|
||||
|
||||
$res['plugins']['icon'] = 'b_engine.png';
|
||||
$res['plugins']['text'] = __('Plugins');
|
||||
|
||||
$res['binlog']['icon'] = 's_tbl.png';
|
||||
$res['binlog']['text'] = __('Binary log');
|
||||
|
||||
$html = '<h2>' . "\n"
|
||||
. PMA_Util::getImage($res[$type]['icon'])
|
||||
. ' ' . $res[$type]['text'] . "\n"
|
||||
. '</h2>' . "\n";
|
||||
return $html;
|
||||
}
|
||||
?>
|
||||
|
||||
36
libraries/server_common.lib.php
Normal file
36
libraries/server_common.lib.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Shared code for server pages
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the html for the sub-page heading
|
||||
*
|
||||
* @param string $type Sub page type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getSubPageHeader($type)
|
||||
{
|
||||
$res = array();
|
||||
|
||||
$res['plugins']['icon'] = 'b_engine.png';
|
||||
$res['plugins']['text'] = __('Plugins');
|
||||
|
||||
$res['binlog']['icon'] = 's_tbl.png';
|
||||
$res['binlog']['text'] = __('Binary log');
|
||||
|
||||
$html = '<h2>' . "\n"
|
||||
. PMA_Util::getImage($res[$type]['icon'])
|
||||
. ' ' . $res[$type]['text'] . "\n"
|
||||
. '</h2>' . "\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
?>
|
||||
@ -12,12 +12,24 @@
|
||||
require_once 'libraries/common.inc.php';
|
||||
|
||||
/**
|
||||
* Does the common work, provides $binary_logs
|
||||
* Does the common work
|
||||
*/
|
||||
require_once 'libraries/server_common.inc.php';
|
||||
|
||||
require_once 'libraries/server_bin_log.lib.php';
|
||||
|
||||
/**
|
||||
* array binary log files
|
||||
*/
|
||||
$binary_logs = PMA_DRIZZLE
|
||||
? null
|
||||
: $GLOBALS['dbi']->fetchResult(
|
||||
'SHOW MASTER LOGS',
|
||||
'Log_name',
|
||||
null,
|
||||
null,
|
||||
PMA_DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
if (! isset($_REQUEST['log'])
|
||||
|| ! array_key_exists($_REQUEST['log'], $binary_logs)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user