- RFE #1434196 More significant digits in /status

- replaced number_format() with PMA_formatNumber()
- coding standards
This commit is contained in:
Sebastian Mendel
2006-02-20 10:07:10 +00:00
parent 0f695e35f9
commit 6e2ee9e001
2 changed files with 126 additions and 134 deletions

View File

@@ -9,6 +9,10 @@ $Source$
* libraries/dbi/mysqli.dbi.lib.php:
- fixed undefined MYSQLI_BINARY_FLAG constant
- 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>
* libraries/common.lib.php: re-establish previous error reporting mode

View File

@@ -8,7 +8,7 @@
if (! defined('PMA_NO_VARIABLES_IMPORT')) {
define('PMA_NO_VARIABLES_IMPORT', true);
}
require_once('./libraries/common.lib.php');
require_once './libraries/common.lib.php';
/**
* Does the common work
@@ -25,7 +25,6 @@ require './libraries/server_links.inc.php';
/**
* Displays the sub-page heading
*/
echo '<a name="_top"></a>' . "\n";
echo '<div id="serverstatus">' . "\n";
echo '<h2>' . "\n"
. ($GLOBALS['cfg']['MainPageIconic']
@@ -369,34 +368,34 @@ foreach ( $sections as $section_name => $section ) {
<th class="name"><?php echo $strReceived; ?></th>
<td class="value"><?php echo
implode(' ',
PMA_formatByteDown( $server_status['Bytes_received'], 3 ) ); ?></td>
PMA_formatByteDown($server_status['Bytes_received'], 4)); ?></td>
<td class="value"><?php echo
implode(' ',
PMA_formatByteDown(
$server_status['Bytes_received'] * $hour_factor, 3 ) ); ?></td>
$server_status['Bytes_received'] * $hour_factor, 4)); ?></td>
</tr>
<tr class="even">
<th class="name"><?php echo $strSent; ?></th>
<td class="value"><?php echo
implode(' ',
PMA_formatByteDown( $server_status['Bytes_sent'], 3 ) ); ?></td>
PMA_formatByteDown($server_status['Bytes_sent'], 4)); ?></td>
<td class="value"><?php echo
implode(' ',
PMA_formatByteDown(
$server_status['Bytes_sent'] * $hour_factor, 3 ) ); ?></td>
$server_status['Bytes_sent'] * $hour_factor, 4)); ?></td>
</tr>
<tr class="odd">
<th class="name"><?php echo $strTotalUC; ?></th>
<td class="value"><?php echo
implode(' ',
PMA_formatByteDown(
$server_status['Bytes_received'] + $server_status['Bytes_sent'], 3 )
$server_status['Bytes_received'] + $server_status['Bytes_sent'], 4)
); ?></td>
<td class="value"><?php echo
implode(' ',
PMA_formatByteDown(
($server_status['Bytes_received'] + $server_status['Bytes_sent'])
* $hour_factor, 3 )
* $hour_factor, 4)
); ?></td>
</tr>
</tbody>
@@ -414,9 +413,7 @@ foreach ( $sections as $section_name => $section ) {
<tr class="odd">
<th class="name"><?php echo $strMaxConnects; ?></th>
<td class="value"><?php echo
number_format( $server_status['Max_used_connections'], 0,
$GLOBALS['number_decimal_separator'],
$GLOBALS['number_thousands_separator']); ?> </td>
PMA_formatNumber($server_status['Max_used_connections'], 0); ?> </td>
<td class="value">--- </td>
<td class="value">--- </td>
</tr>
@@ -429,10 +426,9 @@ foreach ( $sections as $section_name => $section ) {
4, 2); ?></td>
<td class="value"><?php echo
$server_status['Connections'] > 0
? number_format(
? PMA_formatNumber(
$server_status['Aborted_connects'] * 100 / $server_status['Connections'],
2, $GLOBALS['number_decimal_separator'],
$GLOBALS['number_thousands_separator'] ) . '%'
0, 2) . '%'
: '--- '; ?></td>
</tr>
<tr class="odd">
@@ -444,10 +440,9 @@ foreach ( $sections as $section_name => $section ) {
4, 2); ?></td>
<td class="value"><?php echo
$server_status['Connections'] > 0
? number_format(
? PMA_formatNumber(
$server_status['Aborted_clients'] * 100 / $server_status['Connections'],
2, $GLOBALS['number_decimal_separator'],
$GLOBALS['number_thousands_separator']) . '%'
0, 2) . '%'
: '--- '; ?></td>
</tr>
<tr class="even">
@@ -458,8 +453,7 @@ foreach ( $sections as $section_name => $section ) {
PMA_formatNumber($server_status['Connections'] * $hour_factor,
4, 2); ?></td>
<td class="value"><?php echo
number_format( 100, 2, $GLOBALS['number_decimal_separator'],
$GLOBALS['number_thousands_separator'] ); ?>%</td>
PMA_formatNumber(100, 0, 2); ?>%</td>
</tr>
</tbody>
</table>
@@ -468,9 +462,7 @@ foreach ( $sections as $section_name => $section ) {
<h3><?php echo
sprintf($strQueryStatistics,
number_format($server_status['Questions'],
0, $GLOBALS['number_decimal_separator'],
$GLOBALS['number_thousands_separator'] ) ); ?></h3>
PMA_formatNumber($server_status['Questions'], 0)); ?></h3>
<table id="serverstatusqueriessummary" class="data">
<thead>
@@ -484,7 +476,7 @@ foreach ( $sections as $section_name => $section ) {
<tbody>
<tr class="odd">
<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
PMA_formatNumber($server_status['Questions'] * $hour_factor,
3, 2); ?></td>
@@ -542,13 +534,11 @@ foreach ( $sections['com']['vars'] as $name => $value ) {
?>
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
<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
PMA_formatNumber( $value * $hour_factor, 3, 2 ); ?></td>
PMA_formatNumber($value * $hour_factor, 4, 2); ?></td>
<td class="value"><?php echo
number_format( $value * $perc_factor, 2,
$GLOBALS['number_decimal_separator'],
$GLOBALS['number_thousands_separator'] ); ?>%</td>
PMA_formatNumber($value * $perc_factor, 0, 2); ?>%</td>
</tr>
<?php
}
@@ -576,7 +566,7 @@ foreach ( $sections as $section_name => $section ) {
<caption class="tblHeaders">
<a class="top"
href="<?php echo $PHP_SELF . '?' .
PMA_generate_common_url() . '#_top'; ?>"
PMA_generate_common_url() . '#serverstatus'; ?>"
name="<?php echo $section_name; ?>"><?php echo $strPos1; ?>
<?php echo
($GLOBALS['cfg']['MainPageIconic']
@@ -635,13 +625,11 @@ if ( ! empty( $section['title'] ) ) {
}
}
if ('%' === substr($name, -1, 1)) {
echo number_format( $value, 2,
$GLOBALS['number_decimal_separator'],
$GLOBALS['number_thousands_separator'] ) . ' %';
echo PMA_formatNumber($value, 0, 2) . ' %';
} elseif (is_numeric($value) && $value == (int) $value) {
echo PMA_formatNumber( $value, 3, 0 );
echo PMA_formatNumber($value, 4, 0);
} elseif (is_numeric($value)) {
echo PMA_formatNumber( $value, 3, 2 );
echo PMA_formatNumber($value, 4, 2);
} else {
echo htmlspecialchars($value);
}