binary_logs = $this->dbi->fetchResult( 'SHOW MASTER LOGS', 'Log_name', null, DatabaseInterface::CONNECT_USER, DatabaseInterface::QUERY_STORE ); } /** * Index action * * @return void */ public function indexAction() { /** * Does the common work */ include_once 'libraries/server_common.inc.php'; $url_params = array(); if (! isset($_POST['log']) || ! array_key_exists($_POST['log'], $this->binary_logs) ) { $_POST['log'] = ''; } else { $url_params['log'] = $_POST['log']; } if (!empty($_POST['dontlimitchars'])) { $url_params['dontlimitchars'] = 1; } $this->response->addHTML( Template::get('server/sub_page_header')->render([ 'type' => 'binlog', ]) ); $this->response->addHTML($this->_getLogSelector($url_params)); $this->response->addHTML($this->_getLogInfo($url_params)); } /** * Returns the html for log selector. * * @param array $url_params links parameters * * @return string */ private function _getLogSelector(array $url_params) { return Template::get('server/binlog/log_selector')->render( array( 'url_params' => $url_params, 'binary_logs' => $this->binary_logs, 'log' => $_POST['log'], ) ); } /** * Returns the html for binary log information. * * @param array $url_params links parameters * * @return string */ private function _getLogInfo(array $url_params) { /** * Need to find the real end of rows? */ if (! isset($_POST['pos'])) { $pos = 0; } else { /* We need this to be a integer */ $pos = (int) $_POST['pos']; } $sql_query = 'SHOW BINLOG EVENTS'; if (! empty($_POST['log'])) { $sql_query .= ' IN \'' . $_POST['log'] . '\''; } $sql_query .= ' LIMIT ' . $pos . ', ' . intval($GLOBALS['cfg']['MaxRows']); /** * Sends the query */ $result = $this->dbi->query($sql_query); /** * prepare some vars for displaying the result table */ // Gets the list of fields properties if (isset($result) && $result) { $num_rows = $this->dbi->numRows($result); } else { $num_rows = 0; } if (empty($_POST['dontlimitchars'])) { $dontlimitchars = false; } else { $dontlimitchars = true; $url_params['dontlimitchars'] = 1; } //html output $html = Util::getMessage(Message::success(), $sql_query); $html .= '
'; $html .= $this->_getNavigationRow($url_params, $pos, $num_rows, $dontlimitchars); $html .= ' | ' . '|||||
' . __('Log name') . ' | ' . '' . __('Position') . ' | ' . '' . __('Event type') . ' | ' . '' . __('Server ID') . ' | ' . '' . __('Original position') . ' | ' . '' . __('Information') . ' | ' . '
---|