- RFE #1434196 More significant digits in /status
- replaced number_format() with PMA_formatNumber() - coding standards
This commit is contained in:
@@ -9,6 +9,10 @@ $Source$
|
|||||||
* libraries/dbi/mysqli.dbi.lib.php:
|
* libraries/dbi/mysqli.dbi.lib.php:
|
||||||
- fixed undefined MYSQLI_BINARY_FLAG constant
|
- fixed undefined MYSQLI_BINARY_FLAG constant
|
||||||
- documentation
|
- documentation
|
||||||
|
* server_status.php:
|
||||||
|
- RFE #1434196 More significant digits in /status
|
||||||
|
- replaced number_format() with PMA_formatNumber()
|
||||||
|
- coding standards
|
||||||
|
|
||||||
2006-02-19 Marc Delisle <lem9@users.sourceforge.net>
|
2006-02-19 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* libraries/common.lib.php: re-establish previous error reporting mode
|
* libraries/common.lib.php: re-establish previous error reporting mode
|
||||||
|
@@ -5,10 +5,10 @@
|
|||||||
* displays status variables with descriptions and some hints an optmizing
|
* displays status variables with descriptions and some hints an optmizing
|
||||||
* + reset status variables
|
* + reset status variables
|
||||||
*/
|
*/
|
||||||
if ( ! defined( 'PMA_NO_VARIABLES_IMPORT' ) ) {
|
if (! defined('PMA_NO_VARIABLES_IMPORT')) {
|
||||||
define( 'PMA_NO_VARIABLES_IMPORT', true );
|
define('PMA_NO_VARIABLES_IMPORT', true);
|
||||||
}
|
}
|
||||||
require_once('./libraries/common.lib.php');
|
require_once './libraries/common.lib.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the common work
|
* Does the common work
|
||||||
@@ -25,13 +25,12 @@ require './libraries/server_links.inc.php';
|
|||||||
/**
|
/**
|
||||||
* Displays the sub-page heading
|
* Displays the sub-page heading
|
||||||
*/
|
*/
|
||||||
echo '<a name="_top"></a>' . "\n";
|
|
||||||
echo '<div id="serverstatus">' . "\n";
|
echo '<div id="serverstatus">' . "\n";
|
||||||
echo '<h2>' . "\n"
|
echo '<h2>' . "\n"
|
||||||
. ($GLOBALS['cfg']['MainPageIconic']
|
. ($GLOBALS['cfg']['MainPageIconic']
|
||||||
? '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] .
|
? '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] .
|
||||||
's_status.png" width="16" height="16" alt="" />'
|
's_status.png" width="16" height="16" alt="" />'
|
||||||
: '' )
|
: '')
|
||||||
. $strServerStatus . "\n"
|
. $strServerStatus . "\n"
|
||||||
. '</h2>' . "\n";
|
. '</h2>' . "\n";
|
||||||
|
|
||||||
@@ -39,37 +38,37 @@ echo '<h2>' . "\n"
|
|||||||
/**
|
/**
|
||||||
* flush status variables if requested
|
* flush status variables if requested
|
||||||
*/
|
*/
|
||||||
if ( isset( $_REQUEST['flush'] ) ) {
|
if (isset($_REQUEST['flush'])) {
|
||||||
$_flush_commands = array(
|
$_flush_commands = array(
|
||||||
'STATUS',
|
'STATUS',
|
||||||
'TABLES',
|
'TABLES',
|
||||||
'QUERY CACHE',
|
'QUERY CACHE',
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( in_array( $_REQUEST['flush'], $_flush_commands ) ) {
|
if (in_array($_REQUEST['flush'], $_flush_commands)) {
|
||||||
PMA_DBI_query('FLUSH ' . $_REQUEST['flush'] . ';');
|
PMA_DBI_query('FLUSH ' . $_REQUEST['flush'] . ';');
|
||||||
}
|
}
|
||||||
unset( $_flush_commands );
|
unset($_flush_commands);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get status from server
|
* get status from server
|
||||||
*/
|
*/
|
||||||
if ( PMA_MYSQL_INT_VERSION >= 50002 ) {
|
if (PMA_MYSQL_INT_VERSION >= 50002) {
|
||||||
$server_status = PMA_DBI_fetch_result( 'SHOW GLOBAL STATUS', 0, 1 );
|
$server_status = PMA_DBI_fetch_result('SHOW GLOBAL STATUS', 0, 1);
|
||||||
} else {
|
} else {
|
||||||
$server_status = PMA_DBI_fetch_result( 'SHOW STATUS', 0, 1 );
|
$server_status = PMA_DBI_fetch_result('SHOW STATUS', 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* for some calculations we require also some server settings
|
* for some calculations we require also some server settings
|
||||||
*/
|
*/
|
||||||
if ( PMA_MYSQL_INT_VERSION >= 40003 ) {
|
if (PMA_MYSQL_INT_VERSION >= 40003) {
|
||||||
$server_variables = PMA_DBI_fetch_result( 'SHOW GLOBAL VARIABLES', 0, 1 );
|
$server_variables = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES', 0, 1);
|
||||||
} else {
|
} else {
|
||||||
$server_variables = PMA_DBI_fetch_result( 'SHOW VARIABLES', 0, 1 );
|
$server_variables = PMA_DBI_fetch_result('SHOW VARIABLES', 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -77,7 +76,7 @@ if ( PMA_MYSQL_INT_VERSION >= 40003 ) {
|
|||||||
* starttime calculation
|
* starttime calculation
|
||||||
*/
|
*/
|
||||||
$start_time = PMA_DBI_fetch_value(
|
$start_time = PMA_DBI_fetch_value(
|
||||||
'SELECT UNIX_TIMESTAMP() - ' . $server_status['Uptime'] );
|
'SELECT UNIX_TIMESTAMP() - ' . $server_status['Uptime']);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,22 +88,22 @@ $deprecated = array(
|
|||||||
'Com_dealloc_sql' => 'Com_stmt_close',
|
'Com_dealloc_sql' => 'Com_stmt_close',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ( $deprecated as $old => $new ) {
|
foreach ($deprecated as $old => $new) {
|
||||||
if ( isset( $server_status[$old] )
|
if (isset($server_status[$old])
|
||||||
&& isset( $server_status[$new] ) ) {
|
&& isset($server_status[$new])) {
|
||||||
unset( $server_status[$old] );
|
unset($server_status[$old]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset( $deprecated );
|
unset($deprecated);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* calculate some values
|
* calculate some values
|
||||||
*/
|
*/
|
||||||
// Key_buffer_fraction
|
// Key_buffer_fraction
|
||||||
if ( isset( $server_status['Key_blocks_unused'] )
|
if (isset($server_status['Key_blocks_unused'])
|
||||||
&& isset( $server_variables['key_cache_block_size'] )
|
&& isset($server_variables['key_cache_block_size'])
|
||||||
&& isset( $server_variables['key_buffer_size'] ) ) {
|
&& isset($server_variables['key_buffer_size'])) {
|
||||||
$server_status['Key_buffer_fraction_%'] =
|
$server_status['Key_buffer_fraction_%'] =
|
||||||
100
|
100
|
||||||
- $server_status['Key_blocks_unused']
|
- $server_status['Key_blocks_unused']
|
||||||
@@ -112,16 +111,16 @@ if ( isset( $server_status['Key_blocks_unused'] )
|
|||||||
/ $server_variables['key_buffer_size']
|
/ $server_variables['key_buffer_size']
|
||||||
* 100;
|
* 100;
|
||||||
} elseif (
|
} elseif (
|
||||||
isset( $server_status['Key_blocks_used'] )
|
isset($server_status['Key_blocks_used'])
|
||||||
&& isset( $server_variables['key_buffer_size'] ) ) {
|
&& isset($server_variables['key_buffer_size'])) {
|
||||||
$server_status['Key_buffer_fraction_%'] =
|
$server_status['Key_buffer_fraction_%'] =
|
||||||
$server_status['Key_blocks_used']
|
$server_status['Key_blocks_used']
|
||||||
* 1024
|
* 1024
|
||||||
/ $server_variables['key_buffer_size'];
|
/ $server_variables['key_buffer_size'];
|
||||||
}
|
}
|
||||||
// Threads_cache_hitrate
|
// Threads_cache_hitrate
|
||||||
if ( isset( $server_status['Threads_created'] )
|
if (isset($server_status['Threads_created'])
|
||||||
&& isset( $server_status['Connections'] ) ) {
|
&& isset($server_status['Connections'])) {
|
||||||
$server_status['Threads_cache_hitrate_%'] =
|
$server_status['Threads_cache_hitrate_%'] =
|
||||||
100
|
100
|
||||||
- $server_status['Threads_created']
|
- $server_status['Threads_created']
|
||||||
@@ -224,23 +223,23 @@ $allocations = array(
|
|||||||
|
|
||||||
$sections = array(
|
$sections = array(
|
||||||
// section => section name (description)
|
// section => section name (description)
|
||||||
'com' => array( 'title' => '' ),
|
'com' => array('title' => ''),
|
||||||
'query' => array( 'title' => '' ),
|
'query' => array('title' => ''),
|
||||||
'innodb' => array( 'title' => 'InnoDB' ),
|
'innodb' => array('title' => 'InnoDB'),
|
||||||
'ndb' => array( 'title' => 'NDB' ),
|
'ndb' => array('title' => 'NDB'),
|
||||||
'ssl' => array( 'title' => 'SSL' ),
|
'ssl' => array('title' => 'SSL'),
|
||||||
'handler' => array( 'title' => $strHandler ),
|
'handler' => array('title' => $strHandler),
|
||||||
'qcache' => array( 'title' => $strQueryCache ),
|
'qcache' => array('title' => $strQueryCache),
|
||||||
'threads' => array( 'title' => $strThreads ),
|
'threads' => array('title' => $strThreads),
|
||||||
'binlog_cache' => array( 'title' => $strBinaryLog ),
|
'binlog_cache' => array('title' => $strBinaryLog),
|
||||||
'created_tmp' => array( 'title' => $strTempData ),
|
'created_tmp' => array('title' => $strTempData),
|
||||||
'delayed' => array( 'title' => $strServerStatusDelayedInserts ),
|
'delayed' => array('title' => $strServerStatusDelayedInserts),
|
||||||
'key' => array( 'title' => $strKeyCache ),
|
'key' => array('title' => $strKeyCache),
|
||||||
'select' => array( 'title' => $strJoins ),
|
'select' => array('title' => $strJoins),
|
||||||
'repl' => array( 'title' => $strReplication ),
|
'repl' => array('title' => $strReplication),
|
||||||
'sort' => array( 'title' => $strSorting ),
|
'sort' => array('title' => $strSorting),
|
||||||
'table' => array( 'title' => $strNumTables ),
|
'table' => array('title' => $strNumTables),
|
||||||
'tc' => array( 'title' => $strTransactionCoordinator ),
|
'tc' => array('title' => $strTransactionCoordinator),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -298,21 +297,21 @@ $links['innodb']['MySQL - ' . $strDocu]
|
|||||||
|
|
||||||
|
|
||||||
// sort status vars into arrays
|
// sort status vars into arrays
|
||||||
foreach ( $server_status as $name => $value ) {
|
foreach ($server_status as $name => $value) {
|
||||||
if ( isset( $allocations[$name] ) ) {
|
if (isset($allocations[$name])) {
|
||||||
$sections[$allocations[$name]]['vars'][$name] = $value;
|
$sections[$allocations[$name]]['vars'][$name] = $value;
|
||||||
unset( $server_status[$name] );
|
unset($server_status[$name]);
|
||||||
} else {
|
} else {
|
||||||
foreach ( $allocations as $filter => $section ) {
|
foreach ($allocations as $filter => $section) {
|
||||||
if ( preg_match( '/^' . $filter . '/', $name )
|
if (preg_match('/^' . $filter . '/', $name)
|
||||||
&& isset( $server_status[$name] ) ) {
|
&& isset($server_status[$name])) {
|
||||||
unset( $server_status[$name] );
|
unset($server_status[$name]);
|
||||||
$sections[$section]['vars'][$name] = $value;
|
$sections[$section]['vars'][$name] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset( $name, $value, $filter, $section, $allocations );
|
unset($name, $value, $filter, $section, $allocations);
|
||||||
|
|
||||||
// rest
|
// rest
|
||||||
$sections['all']['vars'] =& $server_status;
|
$sections['all']['vars'] =& $server_status;
|
||||||
@@ -337,16 +336,16 @@ $hour_factor = 3600 / $server_status['Uptime'];
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
echo sprintf( $strServerStatusUptime,
|
echo sprintf($strServerStatusUptime,
|
||||||
PMA_timespanFormat( $server_status['Uptime'] ),
|
PMA_timespanFormat($server_status['Uptime']),
|
||||||
PMA_localisedDate( $start_time ) ) . "\n";
|
PMA_localisedDate($start_time)) . "\n";
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div id="sectionlinks">
|
<div id="sectionlinks">
|
||||||
<?php
|
<?php
|
||||||
foreach ( $sections as $section_name => $section ) {
|
foreach ($sections as $section_name => $section) {
|
||||||
if ( ! empty( $section['vars'] ) && ! empty( $section['title'] ) ) {
|
if (! empty($section['vars']) && ! empty($section['title'])) {
|
||||||
echo '<a href="' . $PHP_SELF . '?' .
|
echo '<a href="' . $PHP_SELF . '?' .
|
||||||
PMA_generate_common_url() . '#' . $section_name . '">' .
|
PMA_generate_common_url() . '#' . $section_name . '">' .
|
||||||
$section['title'] . '</a>' . "\n";
|
$section['title'] . '</a>' . "\n";
|
||||||
@@ -369,34 +368,34 @@ foreach ( $sections as $section_name => $section ) {
|
|||||||
<th class="name"><?php echo $strReceived; ?></th>
|
<th class="name"><?php echo $strReceived; ?></th>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
implode(' ',
|
implode(' ',
|
||||||
PMA_formatByteDown( $server_status['Bytes_received'], 3 ) ); ?></td>
|
PMA_formatByteDown($server_status['Bytes_received'], 4)); ?></td>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
implode(' ',
|
implode(' ',
|
||||||
PMA_formatByteDown(
|
PMA_formatByteDown(
|
||||||
$server_status['Bytes_received'] * $hour_factor, 3 ) ); ?></td>
|
$server_status['Bytes_received'] * $hour_factor, 4)); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even">
|
<tr class="even">
|
||||||
<th class="name"><?php echo $strSent; ?></th>
|
<th class="name"><?php echo $strSent; ?></th>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
implode(' ',
|
implode(' ',
|
||||||
PMA_formatByteDown( $server_status['Bytes_sent'], 3 ) ); ?></td>
|
PMA_formatByteDown($server_status['Bytes_sent'], 4)); ?></td>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
implode(' ',
|
implode(' ',
|
||||||
PMA_formatByteDown(
|
PMA_formatByteDown(
|
||||||
$server_status['Bytes_sent'] * $hour_factor, 3 ) ); ?></td>
|
$server_status['Bytes_sent'] * $hour_factor, 4)); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<th class="name"><?php echo $strTotalUC; ?></th>
|
<th class="name"><?php echo $strTotalUC; ?></th>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
implode(' ',
|
implode(' ',
|
||||||
PMA_formatByteDown(
|
PMA_formatByteDown(
|
||||||
$server_status['Bytes_received'] + $server_status['Bytes_sent'], 3 )
|
$server_status['Bytes_received'] + $server_status['Bytes_sent'], 4)
|
||||||
); ?></td>
|
); ?></td>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
implode(' ',
|
implode(' ',
|
||||||
PMA_formatByteDown(
|
PMA_formatByteDown(
|
||||||
($server_status['Bytes_received'] + $server_status['Bytes_sent'])
|
($server_status['Bytes_received'] + $server_status['Bytes_sent'])
|
||||||
* $hour_factor, 3 )
|
* $hour_factor, 4)
|
||||||
); ?></td>
|
); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -414,52 +413,47 @@ foreach ( $sections as $section_name => $section ) {
|
|||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<th class="name"><?php echo $strMaxConnects; ?></th>
|
<th class="name"><?php echo $strMaxConnects; ?></th>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
number_format( $server_status['Max_used_connections'], 0,
|
PMA_formatNumber($server_status['Max_used_connections'], 0); ?> </td>
|
||||||
$GLOBALS['number_decimal_separator'],
|
|
||||||
$GLOBALS['number_thousands_separator']); ?> </td>
|
|
||||||
<td class="value">--- </td>
|
<td class="value">--- </td>
|
||||||
<td class="value">--- </td>
|
<td class="value">--- </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even">
|
<tr class="even">
|
||||||
<th class="name"><?php echo $strFailedAttempts; ?></th>
|
<th class="name"><?php echo $strFailedAttempts; ?></th>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
PMA_formatNumber( $server_status['Aborted_connects'], 4, 0 ); ?></td>
|
PMA_formatNumber($server_status['Aborted_connects'], 4, 0); ?></td>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
PMA_formatNumber( $server_status['Aborted_connects'] * $hour_factor,
|
PMA_formatNumber($server_status['Aborted_connects'] * $hour_factor,
|
||||||
4, 2 ); ?></td>
|
4, 2); ?></td>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
$server_status['Connections'] > 0
|
$server_status['Connections'] > 0
|
||||||
? number_format(
|
? PMA_formatNumber(
|
||||||
$server_status['Aborted_connects'] * 100 / $server_status['Connections'],
|
$server_status['Aborted_connects'] * 100 / $server_status['Connections'],
|
||||||
2, $GLOBALS['number_decimal_separator'],
|
0, 2) . '%'
|
||||||
$GLOBALS['number_thousands_separator'] ) . '%'
|
|
||||||
: '--- '; ?></td>
|
: '--- '; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<th class="name"><?php echo $strAbortedClients; ?></th>
|
<th class="name"><?php echo $strAbortedClients; ?></th>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
PMA_formatNumber( $server_status['Aborted_clients'], 4, 0 ); ?></td>
|
PMA_formatNumber($server_status['Aborted_clients'], 4, 0); ?></td>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
PMA_formatNumber( $server_status['Aborted_clients'] * $hour_factor,
|
PMA_formatNumber($server_status['Aborted_clients'] * $hour_factor,
|
||||||
4, 2 ); ?></td>
|
4, 2); ?></td>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
$server_status['Connections'] > 0
|
$server_status['Connections'] > 0
|
||||||
? number_format(
|
? PMA_formatNumber(
|
||||||
$server_status['Aborted_clients'] * 100 / $server_status['Connections'],
|
$server_status['Aborted_clients'] * 100 / $server_status['Connections'],
|
||||||
2, $GLOBALS['number_decimal_separator'],
|
0, 2) . '%'
|
||||||
$GLOBALS['number_thousands_separator']) . '%'
|
|
||||||
: '--- '; ?></td>
|
: '--- '; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even">
|
<tr class="even">
|
||||||
<th class="name"><?php echo $strTotalUC; ?></th>
|
<th class="name"><?php echo $strTotalUC; ?></th>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
PMA_formatNumber( $server_status['Connections'], 4, 0 ); ?></td>
|
PMA_formatNumber($server_status['Connections'], 4, 0); ?></td>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
PMA_formatNumber( $server_status['Connections'] * $hour_factor,
|
PMA_formatNumber($server_status['Connections'] * $hour_factor,
|
||||||
4, 2 ); ?></td>
|
4, 2); ?></td>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
number_format( 100, 2, $GLOBALS['number_decimal_separator'],
|
PMA_formatNumber(100, 0, 2); ?>%</td>
|
||||||
$GLOBALS['number_thousands_separator'] ); ?>%</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -467,10 +461,8 @@ foreach ( $sections as $section_name => $section ) {
|
|||||||
<hr class="clearfloat" />
|
<hr class="clearfloat" />
|
||||||
|
|
||||||
<h3><?php echo
|
<h3><?php echo
|
||||||
sprintf( $strQueryStatistics,
|
sprintf($strQueryStatistics,
|
||||||
number_format($server_status['Questions'],
|
PMA_formatNumber($server_status['Questions'], 0)); ?></h3>
|
||||||
0, $GLOBALS['number_decimal_separator'],
|
|
||||||
$GLOBALS['number_thousands_separator'] ) ); ?></h3>
|
|
||||||
|
|
||||||
<table id="serverstatusqueriessummary" class="data">
|
<table id="serverstatusqueriessummary" class="data">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -484,18 +476,18 @@ foreach ( $sections as $section_name => $section ) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
PMA_formatNumber( $server_status['Questions'], 3, 0 ); ?></td>
|
PMA_formatNumber($server_status['Questions'], 4, 0); ?></td>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
PMA_formatNumber( $server_status['Questions'] * $hour_factor,
|
PMA_formatNumber($server_status['Questions'] * $hour_factor,
|
||||||
3, 2 ); ?></td>
|
3, 2); ?></td>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
PMA_formatNumber(
|
PMA_formatNumber(
|
||||||
$server_status['Questions'] * 60 / $server_status['Uptime'],
|
$server_status['Questions'] * 60 / $server_status['Uptime'],
|
||||||
3, 2 ); ?></td>
|
3, 2); ?></td>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
PMA_formatNumber(
|
PMA_formatNumber(
|
||||||
$server_status['Questions'] / $server_status['Uptime'],
|
$server_status['Questions'] / $server_status['Uptime'],
|
||||||
3, 2 ); ?></td>
|
3, 2); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -504,16 +496,16 @@ foreach ( $sections as $section_name => $section ) {
|
|||||||
<?php
|
<?php
|
||||||
// number of tables to split values into
|
// number of tables to split values into
|
||||||
$tables = 2;
|
$tables = 2;
|
||||||
$rows_per_table = (int) ceil( count( $sections['com']['vars'] ) / $tables );
|
$rows_per_table = (int) ceil(count($sections['com']['vars']) / $tables);
|
||||||
$current_table = 0;
|
$current_table = 0;
|
||||||
$odd_row = true;
|
$odd_row = true;
|
||||||
$countRows = 0;
|
$countRows = 0;
|
||||||
$perc_factor = 100 / ( $server_status['Questions'] - $server_status['Connections'] );
|
$perc_factor = 100 / ($server_status['Questions'] - $server_status['Connections']);
|
||||||
foreach ( $sections['com']['vars'] as $name => $value ) {
|
foreach ($sections['com']['vars'] as $name => $value) {
|
||||||
$current_table++;
|
$current_table++;
|
||||||
if ( $countRows === 0 || $countRows === $rows_per_table ) {
|
if ($countRows === 0 || $countRows === $rows_per_table) {
|
||||||
$odd_row = true;
|
$odd_row = true;
|
||||||
if ( $countRows === $rows_per_table ) {
|
if ($countRows === $rows_per_table) {
|
||||||
echo ' </tbody>' . "\n";
|
echo ' </tbody>' . "\n";
|
||||||
echo ' </table>' . "\n";
|
echo ' </table>' . "\n";
|
||||||
}
|
}
|
||||||
@@ -537,18 +529,16 @@ foreach ( $sections['com']['vars'] as $name => $value ) {
|
|||||||
// For the percentage column, use Questions - Connections, because
|
// For the percentage column, use Questions - Connections, because
|
||||||
// the number of connections is not an item of the Query types
|
// the number of connections is not an item of the Query types
|
||||||
// but is included in Questions. Then the total of the percentages is 100.
|
// but is included in Questions. Then the total of the percentages is 100.
|
||||||
$name = str_replace( 'Com_', '', $name );
|
$name = str_replace('Com_', '', $name);
|
||||||
$name = str_replace( '_', ' ', $name );
|
$name = str_replace('_', ' ', $name);
|
||||||
?>
|
?>
|
||||||
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
|
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
|
||||||
<th class="name"><?php echo htmlspecialchars( $name ); ?></th>
|
<th class="name"><?php echo htmlspecialchars($name); ?></th>
|
||||||
<td class="value"><?php echo PMA_formatNumber( $value, 3, 0 ); ?></td>
|
<td class="value"><?php echo PMA_formatNumber($value, 4, 0); ?></td>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
PMA_formatNumber( $value * $hour_factor, 3, 2 ); ?></td>
|
PMA_formatNumber($value * $hour_factor, 4, 2); ?></td>
|
||||||
<td class="value"><?php echo
|
<td class="value"><?php echo
|
||||||
number_format( $value * $perc_factor, 2,
|
PMA_formatNumber($value * $perc_factor, 0, 2); ?>%</td>
|
||||||
$GLOBALS['number_decimal_separator'],
|
|
||||||
$GLOBALS['number_thousands_separator'] ); ?>%</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
@@ -569,23 +559,23 @@ unset(
|
|||||||
$server_status['Questions'], $server_status['Uptime']
|
$server_status['Questions'], $server_status['Uptime']
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ( $sections as $section_name => $section ) {
|
foreach ($sections as $section_name => $section) {
|
||||||
if ( ! empty( $section['vars'] ) ) {
|
if (! empty($section['vars'])) {
|
||||||
?>
|
?>
|
||||||
<table class="data" id="serverstatussection<?php echo $section_name; ?>">
|
<table class="data" id="serverstatussection<?php echo $section_name; ?>">
|
||||||
<caption class="tblHeaders">
|
<caption class="tblHeaders">
|
||||||
<a class="top"
|
<a class="top"
|
||||||
href="<?php echo $PHP_SELF . '?' .
|
href="<?php echo $PHP_SELF . '?' .
|
||||||
PMA_generate_common_url() . '#_top'; ?>"
|
PMA_generate_common_url() . '#serverstatus'; ?>"
|
||||||
name="<?php echo $section_name; ?>"><?php echo $strPos1; ?>
|
name="<?php echo $section_name; ?>"><?php echo $strPos1; ?>
|
||||||
<?php echo
|
<?php echo
|
||||||
($GLOBALS['cfg']['MainPageIconic']
|
($GLOBALS['cfg']['MainPageIconic']
|
||||||
? '<img src="' . $GLOBALS['pmaThemeImage'] .
|
? '<img src="' . $GLOBALS['pmaThemeImage'] .
|
||||||
's_asc.png" width="11" height="9" align="middle" alt="" />'
|
's_asc.png" width="11" height="9" align="middle" alt="" />'
|
||||||
: '' ); ?>
|
: ''); ?>
|
||||||
</a>
|
</a>
|
||||||
<?php
|
<?php
|
||||||
if ( ! empty( $section['title'] ) ) {
|
if (! empty($section['title'])) {
|
||||||
echo $section['title'];
|
echo $section['title'];
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -601,16 +591,16 @@ if ( ! empty( $section['title'] ) ) {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<?php
|
<?php
|
||||||
if ( ! empty( $links[$section_name] ) ) {
|
if (! empty($links[$section_name])) {
|
||||||
?>
|
?>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr class="tblFooters">
|
<tr class="tblFooters">
|
||||||
<th colspan="3" class="tblFooters">
|
<th colspan="3" class="tblFooters">
|
||||||
<?php
|
<?php
|
||||||
foreach ( $links[$section_name] as $link_name => $link_url ) {
|
foreach ($links[$section_name] as $link_name => $link_url) {
|
||||||
echo '<a href="' . $link_url . '">' . $link_name . '</a>' . "\n";
|
echo '<a href="' . $link_url . '">' . $link_name . '</a>' . "\n";
|
||||||
}
|
}
|
||||||
unset( $link_url, $link_name );
|
unset($link_url, $link_name);
|
||||||
?>
|
?>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -621,60 +611,58 @@ if ( ! empty( $section['title'] ) ) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
$odd_row = false;
|
$odd_row = false;
|
||||||
foreach ( $section['vars'] as $name => $value ) {
|
foreach ($section['vars'] as $name => $value) {
|
||||||
$odd_row = !$odd_row;
|
$odd_row = !$odd_row;
|
||||||
?>
|
?>
|
||||||
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
|
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
|
||||||
<th class="name"><?php echo htmlspecialchars($name); ?></th>
|
<th class="name"><?php echo htmlspecialchars($name); ?></th>
|
||||||
<td class="value"><?php
|
<td class="value"><?php
|
||||||
if ( isset( $alerts[$name] ) ) {
|
if (isset($alerts[$name])) {
|
||||||
if ( $value > $alerts[$name] ) {
|
if ($value > $alerts[$name]) {
|
||||||
echo '<span class="attention">';
|
echo '<span class="attention">';
|
||||||
} else {
|
} else {
|
||||||
echo '<span class="allfine">';
|
echo '<span class="allfine">';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( '%' === substr( $name, -1, 1 ) ) {
|
if ('%' === substr($name, -1, 1)) {
|
||||||
echo number_format( $value, 2,
|
echo PMA_formatNumber($value, 0, 2) . ' %';
|
||||||
$GLOBALS['number_decimal_separator'],
|
} elseif (is_numeric($value) && $value == (int) $value) {
|
||||||
$GLOBALS['number_thousands_separator'] ) . ' %';
|
echo PMA_formatNumber($value, 4, 0);
|
||||||
} elseif ( is_numeric( $value ) && $value == (int) $value ) {
|
} elseif (is_numeric($value)) {
|
||||||
echo PMA_formatNumber( $value, 3, 0 );
|
echo PMA_formatNumber($value, 4, 2);
|
||||||
} elseif ( is_numeric( $value ) ) {
|
|
||||||
echo PMA_formatNumber( $value, 3, 2 );
|
|
||||||
} else {
|
} else {
|
||||||
echo htmlspecialchars( $value );
|
echo htmlspecialchars($value);
|
||||||
}
|
}
|
||||||
if ( isset( $alerts[$name] ) ) {
|
if (isset($alerts[$name])) {
|
||||||
echo '</span>';
|
echo '</span>';
|
||||||
}
|
}
|
||||||
?></td>
|
?></td>
|
||||||
<td class="descr">
|
<td class="descr">
|
||||||
<?php
|
<?php
|
||||||
if ( isset( $GLOBALS['strShowStatus' . $name . 'Descr'] ) ) {
|
if (isset($GLOBALS['strShowStatus' . $name . 'Descr'])) {
|
||||||
echo $GLOBALS['strShowStatus' . $name . 'Descr'];
|
echo $GLOBALS['strShowStatus' . $name . 'Descr'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $links[$name] ) ) {
|
if (isset($links[$name])) {
|
||||||
foreach ( $links[$name] as $link_name => $link_url ) {
|
foreach ($links[$name] as $link_name => $link_url) {
|
||||||
echo ' <a href="' . $link_url . '">' . $link_name . '</a>' .
|
echo ' <a href="' . $link_url . '">' . $link_name . '</a>' .
|
||||||
"\n";
|
"\n";
|
||||||
}
|
}
|
||||||
unset( $link_url, $link_name );
|
unset($link_url, $link_name);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
unset( $name, $value );
|
unset($name, $value);
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset( $section_name, $section, $sections, $server_status, $odd_row, $alerts );
|
unset($section_name, $section, $sections, $server_status, $odd_row, $alerts);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user