diff options
author | Christian Foellmann <foellmann@foe-services.de> | 2014-12-23 14:48:13 +0300 |
---|---|---|
committer | Christian Foellmann <foellmann@foe-services.de> | 2014-12-23 14:48:13 +0300 |
commit | 2bfb20e57418ebf396149782be9f98e868fe8608 (patch) | |
tree | a5ec4011410970603d3f462a535a5a359057fa77 /libraries/server_status.lib.php | |
parent | 20f1bf77c8281efc675a14e0f6bf52f657dabd9a (diff) |
UPDATE 4.3.34.3.3
Diffstat (limited to 'libraries/server_status.lib.php')
-rw-r--r-- | libraries/server_status.lib.php | 254 |
1 files changed, 14 insertions, 240 deletions
diff --git a/libraries/server_status.lib.php b/libraries/server_status.lib.php index 9e00d0a616..dd1fd72352 100644 --- a/libraries/server_status.lib.php +++ b/libraries/server_status.lib.php @@ -30,9 +30,6 @@ function PMA_getHtmlForServerStatus($ServerStatusData) //display the server state connection information $retval .= PMA_getHtmlForServerStateConnections($ServerStatusData); - //display the server Process List information - $retval .= PMA_getHtmlForServerProcesslist($ServerStatusData); - return $retval; } @@ -72,19 +69,23 @@ function PMA_getHtmlForServerStateGeneralInfo($ServerStatusData) ) . "\n"; $retval .= '</p>'; - if ($GLOBALS['server_master_status'] || $GLOBALS['server_slave_status']) { + if ($GLOBALS['replication_info']['master']['status'] + || $GLOBALS['replication_info']['slave']['status'] + ) { $retval .= '<p class="notice">'; - if ($GLOBALS['server_master_status'] && $GLOBALS['server_slave_status']) { + if ($GLOBALS['replication_info']['master']['status'] + && $GLOBALS['replication_info']['slave']['status'] + ) { $retval .= __( 'This MySQL server works as <b>master</b> and ' . '<b>slave</b> in <b>replication</b> process.' ); - } elseif ($GLOBALS['server_master_status']) { + } elseif ($GLOBALS['replication_info']['master']['status']) { $retval .= __( 'This MySQL server works as <b>master</b> ' . 'in <b>replication</b> process.' ); - } elseif ($GLOBALS['server_slave_status']) { + } elseif ($GLOBALS['replication_info']['slave']['status']) { $retval .= __( 'This MySQL server works as <b>slave</b> ' . 'in <b>replication</b> process.' @@ -97,13 +98,17 @@ function PMA_getHtmlForServerStateGeneralInfo($ServerStatusData) * if the server works as master or slave in replication process, * display useful information */ - if ($GLOBALS['server_master_status'] || $GLOBALS['server_slave_status']) { + if ($GLOBALS['replication_info']['master']['status'] + || $GLOBALS['replication_info']['slave']['status'] + ) { $retval .= '<hr class="clearfloat" />'; $retval .= '<h3><a name="replication">'; $retval .= __('Replication status'); $retval .= '</a></h3>'; foreach ($GLOBALS['replication_types'] as $type) { - if (isset(${"server_{$type}_status"}) && ${"server_{$type}_status"}) { + if (isset($GLOBALS['replication_info'][$type]['status']) + && $GLOBALS['replication_info'][$type]['status'] + ) { $retval .= PMA_getHtmlForReplicationStatusTable($type); } } @@ -309,235 +314,4 @@ function PMA_getHtmlForServerStateConnections($ServerStatusData) return $retval; } -/** - * Prints Server Process list - * - * @return string - */ -function PMA_getHtmlForServerProcesslist() -{ - $url_params = array(); - - $show_full_sql = ! empty($_REQUEST['full']); - if ($show_full_sql) { - $url_params['full'] = 1; - $full_text_link = 'server_status.php' . PMA_URL_getCommon( - array(), 'html', '?' - ); - } else { - $full_text_link = 'server_status.php' . PMA_URL_getCommon( - array('full' => 1) - ); - } - - // This array contains display name and real column name of each - // sortable column in the table - $sortable_columns = array( - array( - 'column_name' => __('ID'), - 'order_by_field' => 'Id' - ), - array( - 'column_name' => __('User'), - 'order_by_field' => 'User' - ), - array( - 'column_name' => __('Host'), - 'order_by_field' => 'Host' - ), - array( - 'column_name' => __('Database'), - 'order_by_field' => 'db' - ), - array( - 'column_name' => __('Command'), - 'order_by_field' => 'Command' - ), - array( - 'column_name' => __('Time'), - 'order_by_field' => 'Time' - ), - array( - 'column_name' => __('Status'), - 'order_by_field' => 'State' - ), - array( - 'column_name' => __('SQL query'), - 'order_by_field' => 'Info' - ) - ); - $sortableColCount = count($sortable_columns); - - if (PMA_DRIZZLE) { - $left_str = 'left(p.info, ' - . (int)$GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] . ')'; - $sql_query = "SELECT - p.id AS Id, - p.username AS User, - p.host AS Host, - p.db AS db, - p.command AS Command, - p.time AS Time, - p.state AS State," - . ($show_full_sql ? 's.query' : $left_str ) - . " AS Info FROM data_dictionary.PROCESSLIST p " - . ($show_full_sql - ? 'LEFT JOIN data_dictionary.SESSIONS s ON s.session_id = p.id' - : ''); - if (! empty($_REQUEST['order_by_field']) - && ! empty($_REQUEST['sort_order']) - ) { - $sql_query .= ' ORDER BY p.' . $_REQUEST['order_by_field'] . ' ' - . $_REQUEST['sort_order']; - } - } else { - $sql_query = $show_full_sql - ? 'SHOW FULL PROCESSLIST' - : 'SHOW PROCESSLIST'; - if (! empty($_REQUEST['order_by_field']) - && ! empty($_REQUEST['sort_order']) - ) { - $sql_query = 'SELECT * FROM `INFORMATION_SCHEMA`.`PROCESSLIST` ' - . 'ORDER BY `' - . $_REQUEST['order_by_field'] . '` ' . $_REQUEST['sort_order']; - } - } - - $result = $GLOBALS['dbi']->query($sql_query); - - $retval = '<table id="tableprocesslist" ' - . 'class="data clearfloat noclick sortable">'; - $retval .= '<thead>'; - $retval .= '<tr>'; - $retval .= '<th>' . __('Processes') . '</th>'; - foreach ($sortable_columns as $column) { - - $is_sorted = ! empty($_REQUEST['order_by_field']) - && ! empty($_REQUEST['sort_order']) - && ($_REQUEST['order_by_field'] == $column['order_by_field']); - - $column['sort_order'] = 'ASC'; - if ($is_sorted && $_REQUEST['sort_order'] === 'ASC') { - $column['sort_order'] = 'DESC'; - } - - if ($is_sorted) { - if ($_REQUEST['sort_order'] == 'ASC') { - $asc_display_style = 'inline'; - $desc_display_style = 'none'; - } elseif ($_REQUEST['sort_order'] == 'DESC') { - $desc_display_style = 'inline'; - $asc_display_style = 'none'; - } - } - - $retval .= '<th>'; - $columnUrl = PMA_URL_getCommon($column); - $retval .= '<a href="server_status.php' . $columnUrl . '" '; - if ($is_sorted) { - $retval .= 'onmouseout="$(\'.soimg\').toggle()" ' - . 'onmouseover="$(\'.soimg\').toggle()"'; - } - $retval .= '>'; - - $retval .= $column['column_name']; - - if ($is_sorted) { - $retval .= '<img class="icon ic_s_desc soimg" alt="' - . __('Descending') . '" title="" src="themes/dot.gif" ' - . 'style="display: ' . $desc_display_style . '" />'; - $retval .= '<img class="icon ic_s_asc soimg hide" alt="' - . __('Ascending') . '" title="" src="themes/dot.gif" ' - . 'style="display: ' . $asc_display_style . '" />'; - } - - $retval .= '</a>'; - - if (! PMA_DRIZZLE && (0 === --$sortableColCount)) { - $retval .= '<a href="' . $full_text_link . '">'; - if ($show_full_sql) { - $retval .= PMA_Util::getImage( - 's_partialtext.png', - __('Truncate Shown Queries') - ); - } else { - $retval .= PMA_Util::getImage( - 's_fulltext.png', - __('Show Full Queries') - ); - } - $retval .= '</a>'; - } - $retval .= '</th>'; - } - - $retval .= '</tr>'; - $retval .= '</thead>'; - $retval .= '<tbody>'; - - $odd_row = true; - while ($process = $GLOBALS['dbi']->fetchAssoc($result)) { - $retval .= PMA_getHtmlForServerProcessItem( - $process, - $odd_row, - $show_full_sql - ); - $odd_row = ! $odd_row; - } - $retval .= '</tbody>'; - $retval .= '</table>'; - - return $retval; -} - -/** - * Prints Every Item of Server Process - * - * @param Array $process data of Every Item of Server Process - * @param bool $odd_row display odd row or not - * @param bool $show_full_sql show full sql or not - * - * @return string - */ -function PMA_getHtmlForServerProcessItem($process, $odd_row, $show_full_sql) -{ - // Array keys need to modify due to the way it has used - // to display column values - if (! empty($_REQUEST['order_by_field']) && ! empty($_REQUEST['sort_order']) ) { - foreach (array_keys($process) as $key) { - $new_key = ucfirst(strtolower($key)); - $process[$new_key] = $process[$key]; - unset($process[$key]); - } - } - - $url_params = array(); - $url_params['kill'] = $process['Id']; - $kill_process = 'server_status.php' . PMA_URL_getCommon($url_params); - - $retval = '<tr class="' . ($odd_row ? 'odd' : 'even') . '">'; - $retval .= '<td><a href="' . $kill_process . '">' . __('Kill') . '</a></td>'; - $retval .= '<td class="value">' . $process['Id'] . '</td>'; - $retval .= '<td>' . htmlspecialchars($process['User']) . '</td>'; - $retval .= '<td>' . htmlspecialchars($process['Host']) . '</td>'; - $retval .= '<td>' . ((! isset($process['db']) || ! strlen($process['db'])) - ? '<i>' . __('None') . '</i>' - : htmlspecialchars($process['db'])) . '</td>'; - $retval .= '<td>' . htmlspecialchars($process['Command']) . '</td>'; - $retval .= '<td class="value">' . $process['Time'] . '</td>'; - $processStatusStr = empty($process['State']) ? '---' : $process['State']; - $retval .= '<td>' . $processStatusStr . '</td>'; - $retval .= '<td>'; - - if (empty($process['Info'])) { - $retval .= '---'; - } else { - $retval .= PMA_Util::formatSql($process['Info'], ! $show_full_sql); - } - $retval .= '</td>'; - $retval .= '</tr>'; - - return $retval; -} - ?> |