fixed bug: high ascii char in preg_match

This commit is contained in:
Sebastian Mendel
2006-01-25 08:16:40 +00:00
parent fcbfad8708
commit 15b490cfc4
2 changed files with 59 additions and 55 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2006-01-25 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* server_status.php:
fixed bug: high ascii char in preg_match
2006-01-24 Marc Delisle <lem9@users.sourceforge.net> 2006-01-24 Marc Delisle <lem9@users.sourceforge.net>
* lang/*: strViewMaxExactCount for the VIEW row count detection * lang/*: strViewMaxExactCount for the VIEW row count detection
I'm working on... I'm working on...

View File

@@ -29,7 +29,7 @@ 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"
@@ -45,7 +45,7 @@ if ( isset( $_REQUEST['flush'] ) ) {
'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'] . ';');
} }
@@ -103,9 +103,9 @@ unset( $deprecated );
*/ */
// 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']
* $server_variables['key_cache_block_size'] * $server_variables['key_cache_block_size']
@@ -114,7 +114,7 @@ if ( isset( $server_status['Key_blocks_unused'] )
} 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'];
@@ -139,14 +139,14 @@ $alerts = array(
// variable => max value // variable => max value
'Aborted_clients' => 0, 'Aborted_clients' => 0,
'Aborted_connects' => 0, 'Aborted_connects' => 0,
'Binlog_cache_disk_use' => 0, 'Binlog_cache_disk_use' => 0,
'Created_tmp_disk_tables' => 0, 'Created_tmp_disk_tables' => 0,
'Handler_read_rnd' => 0, 'Handler_read_rnd' => 0,
'Handler_read_rnd_next' => 0, 'Handler_read_rnd_next' => 0,
'Innodb_buffer_pool_pages_dirty' => 0, 'Innodb_buffer_pool_pages_dirty' => 0,
'Innodb_buffer_pool_reads' => 0, 'Innodb_buffer_pool_reads' => 0,
'Innodb_buffer_pool_wait_free' => 0, 'Innodb_buffer_pool_wait_free' => 0,
@@ -154,7 +154,7 @@ $alerts = array(
'Innodb_row_lock_time_avg' => 10, // ms 'Innodb_row_lock_time_avg' => 10, // ms
'Innodb_row_lock_time_max' => 50, // ms 'Innodb_row_lock_time_max' => 50, // ms
'Innodb_row_lock_waits' => 0, 'Innodb_row_lock_waits' => 0,
'Slow_queries' => 0, 'Slow_queries' => 0,
'Delayed_errors' => 0, 'Delayed_errors' => 0,
'Select_full_join' => 0, 'Select_full_join' => 0,
@@ -164,19 +164,19 @@ $alerts = array(
'Table_locks_waited' => 0, 'Table_locks_waited' => 0,
'Qcache_lowmem_prunes' => 0, 'Qcache_lowmem_prunes' => 0,
'Slow_launch_threads' => 0, 'Slow_launch_threads' => 0,
// depends on Key_read_requests // depends on Key_read_requests
// normaly lower then 1:0.01 // normaly lower then 1:0.01
'Key_reads' => (0.01 * $server_status['Key_read_requests']), 'Key_reads' => (0.01 * $server_status['Key_read_requests']),
// depends on Key_write_requests // depends on Key_write_requests
// normaly nearly 1:1 // normaly nearly 1:1
'Key_writes' => (0.9 * $server_status['Key_write_requests']), 'Key_writes' => (0.9 * $server_status['Key_write_requests']),
'Key_buffer_fraction' => 0.5, 'Key_buffer_fraction' => 0.5,
// alert if more than 95% of thread cache is in use // alert if more than 95% of thread cache is in use
'Threads_cached' => 0.95 * $server_variables['thread_cache_size'] 'Threads_cached' => 0.95 * $server_variables['thread_cache_size']
// higher is better // higher is better
// variable => min value // variable => min value
//'Handler read key' => '> ', //'Handler read key' => '> ',
@@ -197,28 +197,28 @@ $allocations = array(
'Qcache_' => 'qcache', 'Qcache_' => 'qcache',
'Threads_' => 'threads', 'Threads_' => 'threads',
'Slow_launch_threads' => 'threads', 'Slow_launch_threads' => 'threads',
'Binlog_cache_' => 'binlog_cache', 'Binlog_cache_' => 'binlog_cache',
'Created_tmp_' => 'created_tmp', 'Created_tmp_' => 'created_tmp',
'Key_' => 'key', 'Key_' => 'key',
'Delayed_' => 'delayed', 'Delayed_' => 'delayed',
'Not_flushed_delayed_rows' => 'delayed', 'Not_flushed_delayed_rows' => 'delayed',
'Flush_commands' => 'query', 'Flush_commands' => 'query',
'Last_query_cost' => 'query', 'Last_query_cost' => 'query',
'Slow_queries' => 'query', 'Slow_queries' => 'query',
'Select_' => 'select', 'Select_' => 'select',
'Sort_' => 'sort', 'Sort_' => 'sort',
'Open_tables' => 'table', 'Open_tables' => 'table',
'Opened_tables' => 'table', 'Opened_tables' => 'table',
'Table_locks_' => 'table', 'Table_locks_' => 'table',
'Rpl_status' => 'repl', 'Rpl_status' => 'repl',
'Slave_' => 'repl', 'Slave_' => 'repl',
'Tc_' => 'tc', 'Tc_' => 'tc',
); );
@@ -253,20 +253,20 @@ $links = array();
$links['table'][$strFlushTables] $links['table'][$strFlushTables]
= $PHP_SELF . '?flush=TABLES&amp;' . PMA_generate_common_url(); = $PHP_SELF . '?flush=TABLES&amp;' . PMA_generate_common_url();
$links['table'][$strShowOpenTables] $links['table'][$strShowOpenTables]
= 'sql.php?sql_query=' . urlencode('SHOW OPEN TABLES') . = 'sql.php?sql_query=' . urlencode('SHOW OPEN TABLES') .
'&amp;goto=server_status.php&amp;' . PMA_generate_common_url(); '&amp;goto=server_status.php&amp;' . PMA_generate_common_url();
$links['repl'][$strShowSlaveHosts] $links['repl'][$strShowSlaveHosts]
= 'sql.php?sql_query=' . urlencode('SHOW SLAVE HOSTS') . = 'sql.php?sql_query=' . urlencode('SHOW SLAVE HOSTS') .
'&amp;goto=server_status.php&amp;' . PMA_generate_common_url(); '&amp;goto=server_status.php&amp;' . PMA_generate_common_url();
$links['repl'][$strShowSlaveStatus] $links['repl'][$strShowSlaveStatus]
= 'sql.php?sql_query=' . urlencode('SHOW SLAVE STATUS') . = 'sql.php?sql_query=' . urlencode('SHOW SLAVE STATUS') .
'&amp;goto=server_status.php&amp;' . PMA_generate_common_url(); '&amp;goto=server_status.php&amp;' . PMA_generate_common_url();
$links['repl']['MySQL - ' . $strDocu] $links['repl']['MySQL - ' . $strDocu]
= $cfg['MySQLManualBase'] . '/replication.html'; = $cfg['MySQLManualBase'] . '/replication.html';
$links['qcache'][$strFlushQueryCache] $links['qcache'][$strFlushQueryCache]
= $PHP_SELF . '?flush=' . urlencode('QUERY CACHE') . '&amp;' . = $PHP_SELF . '?flush=' . urlencode('QUERY CACHE') . '&amp;' .
PMA_generate_common_url(); PMA_generate_common_url();
$links['qcache']['MySQL - ' . $strDocu] $links['qcache']['MySQL - ' . $strDocu]
= $cfg['MySQLManualBase'] . '/query-cache.html'; = $cfg['MySQLManualBase'] . '/query-cache.html';
@@ -291,7 +291,7 @@ $links['Slow_queries']['MySQL - ' . $strDocu]
$links['innodb'][$strServerTabVariables] $links['innodb'][$strServerTabVariables]
= 'server_engines.php?engine=innodb&amp;' . PMA_generate_common_url(); = 'server_engines.php?engine=innodb&amp;' . PMA_generate_common_url();
$links['innodb'][$strInnodbStat] $links['innodb'][$strInnodbStat]
= 'server_engines.php?engine=innodb&amp;page=status&amp;' . = 'server_engines.php?engine=innodb&amp;page=status&amp;' .
PMA_generate_common_url(); PMA_generate_common_url();
$links['innodb']['MySQL - ' . $strDocu] $links['innodb']['MySQL - ' . $strDocu]
= $cfg['MySQLManualBase'] . '/innodb.html'; = $cfg['MySQLManualBase'] . '/innodb.html';
@@ -304,7 +304,7 @@ foreach ( $server_status as $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( '<EFBFBD>^' . $filter . '<EFBFBD>i', $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;
@@ -324,20 +324,20 @@ $hour_factor = 3600 / $server_status['Uptime'];
*/ */
?> ?>
<div id="statuslinks"> <div id="statuslinks">
<a href="<?php echo <a href="<?php echo
$PHP_SELF . '?' . PMA_generate_common_url(); ?>" $PHP_SELF . '?' . PMA_generate_common_url(); ?>"
><?php echo $strRefresh; ?></a> ><?php echo $strRefresh; ?></a>
<a href="<?php echo <a href="<?php echo
$PHP_SELF . '?flush=STATUS&amp;' . PMA_generate_common_url(); ?>" $PHP_SELF . '?flush=STATUS&amp;' . PMA_generate_common_url(); ?>"
><?php echo $strShowStatusReset; ?></a> ><?php echo $strShowStatusReset; ?></a>
<a href="<?php echo <a href="<?php echo
$cfg['MySQLManualBase']; ?>/server-status-variables.html" $cfg['MySQLManualBase']; ?>/server-status-variables.html"
target="documentation">MySQL - <?php echo $strDocu; ?></a> target="documentation">MySQL - <?php echo $strDocu; ?></a>
</div> </div>
<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";
?> ?>
@@ -347,8 +347,8 @@ echo sprintf( $strServerStatusUptime,
<?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";
} }
} }
@@ -388,12 +388,12 @@ foreach ( $sections as $section_name => $section ) {
<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'], 3 )
); ?></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, 3 )
@@ -413,7 +413,7 @@ foreach ( $sections as $section_name => $section ) {
<tbody> <tbody>
<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, number_format( $server_status['Max_used_connections'], 0,
$GLOBALS['number_decimal_separator'], $GLOBALS['number_decimal_separator'],
$GLOBALS['number_thousands_separator']); ?> </td> $GLOBALS['number_thousands_separator']); ?> </td>
@@ -422,12 +422,12 @@ foreach ( $sections as $section_name => $section ) {
</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( ? number_format(
$server_status['Aborted_connects'] * 100 / $server_status['Connections'], $server_status['Aborted_connects'] * 100 / $server_status['Connections'],
@@ -437,12 +437,12 @@ foreach ( $sections as $section_name => $section ) {
</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( ? number_format(
$server_status['Aborted_clients'] * 100 / $server_status['Connections'], $server_status['Aborted_clients'] * 100 / $server_status['Connections'],
@@ -452,12 +452,12 @@ foreach ( $sections as $section_name => $section ) {
</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'], number_format( 100, 2, $GLOBALS['number_decimal_separator'],
$GLOBALS['number_thousands_separator'] ); ?>%</td> $GLOBALS['number_thousands_separator'] ); ?>%</td>
</tr> </tr>
@@ -483,16 +483,16 @@ foreach ( $sections as $section_name => $section ) {
</thead> </thead>
<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'], 3, 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>
@@ -505,7 +505,7 @@ foreach ( $sections as $section_name => $section ) {
// 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'] );
@@ -533,7 +533,7 @@ foreach ( $sections['com']['vars'] as $name => $value ) {
$odd_row = !$odd_row; $odd_row = !$odd_row;
} }
$countRows++; $countRows++;
// 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.
@@ -575,12 +575,12 @@ foreach ( $sections as $section_name => $section ) {
<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() . '#_top'; ?>"
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>
@@ -654,10 +654,10 @@ if ( ! empty( $section['title'] ) ) {
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 );