From 15b490cfc4da8d7fd9d021b4d2e5e65a7faf3d00 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Wed, 25 Jan 2006 08:16:40 +0000 Subject: [PATCH] fixed bug: high ascii char in preg_match --- ChangeLog | 4 ++ server_status.php | 110 +++++++++++++++++++++++----------------------- 2 files changed, 59 insertions(+), 55 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1392f8938..b2c8cb664 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2006-01-25 Sebastian Mendel + * server_status.php: + fixed bug: high ascii char in preg_match + 2006-01-24 Marc Delisle * lang/*: strViewMaxExactCount for the VIEW row count detection I'm working on... diff --git a/server_status.php b/server_status.php index 3deabe106..28859bd0a 100644 --- a/server_status.php +++ b/server_status.php @@ -29,7 +29,7 @@ echo '' . "\n"; echo '
' . "\n"; echo '

' . "\n" . ($GLOBALS['cfg']['MainPageIconic'] - ? '' : '' ) . $strServerStatus . "\n" @@ -45,7 +45,7 @@ if ( isset( $_REQUEST['flush'] ) ) { 'TABLES', 'QUERY CACHE', ); - + if ( in_array( $_REQUEST['flush'], $_flush_commands ) ) { PMA_DBI_query('FLUSH ' . $_REQUEST['flush'] . ';'); } @@ -103,9 +103,9 @@ unset( $deprecated ); */ // Key_buffer_fraction 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'] ) ) { - $server_status['Key_buffer_fraction_%'] = + $server_status['Key_buffer_fraction_%'] = 100 - $server_status['Key_blocks_unused'] * $server_variables['key_cache_block_size'] @@ -114,7 +114,7 @@ if ( isset( $server_status['Key_blocks_unused'] ) } elseif ( isset( $server_status['Key_blocks_used'] ) && isset( $server_variables['key_buffer_size'] ) ) { - $server_status['Key_buffer_fraction_%'] = + $server_status['Key_buffer_fraction_%'] = $server_status['Key_blocks_used'] * 1024 / $server_variables['key_buffer_size']; @@ -139,14 +139,14 @@ $alerts = array( // variable => max value 'Aborted_clients' => 0, 'Aborted_connects' => 0, - + 'Binlog_cache_disk_use' => 0, - + 'Created_tmp_disk_tables' => 0, - + 'Handler_read_rnd' => 0, 'Handler_read_rnd_next' => 0, - + 'Innodb_buffer_pool_pages_dirty' => 0, 'Innodb_buffer_pool_reads' => 0, 'Innodb_buffer_pool_wait_free' => 0, @@ -154,7 +154,7 @@ $alerts = array( 'Innodb_row_lock_time_avg' => 10, // ms 'Innodb_row_lock_time_max' => 50, // ms 'Innodb_row_lock_waits' => 0, - + 'Slow_queries' => 0, 'Delayed_errors' => 0, 'Select_full_join' => 0, @@ -164,19 +164,19 @@ $alerts = array( 'Table_locks_waited' => 0, 'Qcache_lowmem_prunes' => 0, 'Slow_launch_threads' => 0, - + // depends on Key_read_requests // normaly lower then 1:0.01 'Key_reads' => (0.01 * $server_status['Key_read_requests']), // depends on Key_write_requests // normaly nearly 1:1 'Key_writes' => (0.9 * $server_status['Key_write_requests']), - + 'Key_buffer_fraction' => 0.5, - + // alert if more than 95% of thread cache is in use 'Threads_cached' => 0.95 * $server_variables['thread_cache_size'] - + // higher is better // variable => min value //'Handler read key' => '> ', @@ -197,28 +197,28 @@ $allocations = array( 'Qcache_' => 'qcache', 'Threads_' => 'threads', 'Slow_launch_threads' => 'threads', - + 'Binlog_cache_' => 'binlog_cache', 'Created_tmp_' => 'created_tmp', 'Key_' => 'key', - + 'Delayed_' => 'delayed', 'Not_flushed_delayed_rows' => 'delayed', - + 'Flush_commands' => 'query', 'Last_query_cost' => 'query', 'Slow_queries' => 'query', - + 'Select_' => 'select', 'Sort_' => 'sort', - + 'Open_tables' => 'table', 'Opened_tables' => 'table', 'Table_locks_' => 'table', - + 'Rpl_status' => 'repl', 'Slave_' => 'repl', - + 'Tc_' => 'tc', ); @@ -253,20 +253,20 @@ $links = array(); $links['table'][$strFlushTables] = $PHP_SELF . '?flush=TABLES&' . PMA_generate_common_url(); $links['table'][$strShowOpenTables] - = 'sql.php?sql_query=' . urlencode('SHOW OPEN TABLES') . + = 'sql.php?sql_query=' . urlencode('SHOW OPEN TABLES') . '&goto=server_status.php&' . PMA_generate_common_url(); $links['repl'][$strShowSlaveHosts] - = 'sql.php?sql_query=' . urlencode('SHOW SLAVE HOSTS') . + = 'sql.php?sql_query=' . urlencode('SHOW SLAVE HOSTS') . '&goto=server_status.php&' . PMA_generate_common_url(); $links['repl'][$strShowSlaveStatus] - = 'sql.php?sql_query=' . urlencode('SHOW SLAVE STATUS') . + = 'sql.php?sql_query=' . urlencode('SHOW SLAVE STATUS') . '&goto=server_status.php&' . PMA_generate_common_url(); $links['repl']['MySQL - ' . $strDocu] = $cfg['MySQLManualBase'] . '/replication.html'; $links['qcache'][$strFlushQueryCache] - = $PHP_SELF . '?flush=' . urlencode('QUERY CACHE') . '&' . + = $PHP_SELF . '?flush=' . urlencode('QUERY CACHE') . '&' . PMA_generate_common_url(); $links['qcache']['MySQL - ' . $strDocu] = $cfg['MySQLManualBase'] . '/query-cache.html'; @@ -291,7 +291,7 @@ $links['Slow_queries']['MySQL - ' . $strDocu] $links['innodb'][$strServerTabVariables] = 'server_engines.php?engine=innodb&' . PMA_generate_common_url(); $links['innodb'][$strInnodbStat] - = 'server_engines.php?engine=innodb&page=status&' . + = 'server_engines.php?engine=innodb&page=status&' . PMA_generate_common_url(); $links['innodb']['MySQL - ' . $strDocu] = $cfg['MySQLManualBase'] . '/innodb.html'; @@ -304,7 +304,7 @@ foreach ( $server_status as $name => $value ) { unset( $server_status[$name] ); } else { foreach ( $allocations as $filter => $section ) { - if ( preg_match( '�^' . $filter . '�i', $name ) + if ( preg_match( '/^' . $filter . '/', $name ) && isset( $server_status[$name] ) ) { unset( $server_status[$name] ); $sections[$section]['vars'][$name] = $value; @@ -324,20 +324,20 @@ $hour_factor = 3600 / $server_status['Uptime']; */ ?>

@@ -347,8 +347,8 @@ echo sprintf( $strServerStatusUptime, $section ) { if ( ! empty( $section['vars'] ) && ! empty( $section['title'] ) ) { - echo '' . + echo '' . $section['title'] . '' . "\n"; } } @@ -388,12 +388,12 @@ foreach ( $sections as $section_name => $section ) { $section ) { - @@ -422,12 +422,12 @@ foreach ( $sections as $section_name => $section ) { - - - 0 ? number_format( $server_status['Aborted_connects'] * 100 / $server_status['Connections'], @@ -437,12 +437,12 @@ foreach ( $sections as $section_name => $section ) { - - - 0 ? number_format( $server_status['Aborted_clients'] * 100 / $server_status['Connections'], @@ -452,12 +452,12 @@ foreach ( $sections as $section_name => $section ) { - - - % @@ -483,16 +483,16 @@ foreach ( $sections as $section_name => $section ) { - - - - @@ -505,7 +505,7 @@ foreach ( $sections as $section_name => $section ) { // number of tables to split values into $tables = 2; $rows_per_table = (int) ceil( count( $sections['com']['vars'] ) / $tables ); -$current_table = 0; +$current_table = 0; $odd_row = true; $countRows = 0; $perc_factor = 100 / ( $server_status['Questions'] - $server_status['Connections'] ); @@ -533,7 +533,7 @@ foreach ( $sections['com']['vars'] as $name => $value ) { $odd_row = !$odd_row; } $countRows++; - + // For the percentage column, use Questions - Connections, because // 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. @@ -575,12 +575,12 @@ foreach ( $sections as $section_name => $section ) {
" name=""> ' : '' ); ?> @@ -654,10 +654,10 @@ if ( ! empty( $section['title'] ) ) { if ( isset( $GLOBALS['strShowStatus' . $name . 'Descr'] ) ) { echo $GLOBALS['strShowStatus' . $name . 'Descr']; } - + if ( isset( $links[$name] ) ) { foreach ( $links[$name] as $link_name => $link_url ) { - echo ' ' . $link_name . '' . + echo ' ' . $link_name . '' . "\n"; } unset( $link_url, $link_name );