- 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: * 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

View File

@@ -8,7 +8,7 @@
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,7 +25,6 @@ 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']
@@ -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,9 +413,7 @@ 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>
@@ -429,10 +426,9 @@ foreach ( $sections as $section_name => $section ) {
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">
@@ -444,10 +440,9 @@ foreach ( $sections as $section_name => $section ) {
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">
@@ -458,8 +453,7 @@ foreach ( $sections as $section_name => $section ) {
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>
@@ -468,9 +462,7 @@ foreach ( $sections as $section_name => $section ) {
<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,7 +476,7 @@ 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>
@@ -542,13 +534,11 @@ foreach ( $sections['com']['vars'] as $name => $value ) {
?> ?>
<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
} }
@@ -576,7 +566,7 @@ foreach ( $sections as $section_name => $section ) {
<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']
@@ -635,13 +625,11 @@ if ( ! empty( $section['title'] ) ) {
} }
} }
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'],
$GLOBALS['number_thousands_separator'] ) . ' %';
} elseif (is_numeric($value) && $value == (int) $value) { } elseif (is_numeric($value) && $value == (int) $value) {
echo PMA_formatNumber( $value, 3, 0 ); echo PMA_formatNumber($value, 4, 0);
} elseif (is_numeric($value)) { } elseif (is_numeric($value)) {
echo PMA_formatNumber( $value, 3, 2 ); echo PMA_formatNumber($value, 4, 2);
} else { } else {
echo htmlspecialchars($value); echo htmlspecialchars($value);
} }