From f033d02497a38d8e723e016f14655ec6acfed940 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Tue, 2 Jun 2015 08:03:06 -0400 Subject: [PATCH 1/2] Refactor Signed-off-by: Marc Delisle --- libraries/ServerStatusData.class.php | 290 +++++++++++++++------------ 1 file changed, 161 insertions(+), 129 deletions(-) diff --git a/libraries/ServerStatusData.class.php b/libraries/ServerStatusData.class.php index d0def03985..46dbf17bff 100644 --- a/libraries/ServerStatusData.class.php +++ b/libraries/ServerStatusData.class.php @@ -48,6 +48,164 @@ class PMA_ServerStatusData // Discard everything } + /** + * Gets the allocations for constructor + * + * @return array + */ + private function _getAllocations() + { + return array( + // variable name => section + // variable names match when they begin with the given string + + 'Com_' => 'com', + 'Innodb_' => 'innodb', + 'Ndb_' => 'ndb', + 'Handler_' => 'handler', + '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', + 'Queries' => 'query', + 'Prepared_stmt_count' => 'query', + + 'Select_' => 'select', + 'Sort_' => 'sort', + + 'Open_tables' => 'table', + 'Opened_tables' => 'table', + 'Open_table_definitions' => 'table', + 'Opened_table_definitions' => 'table', + 'Table_locks_' => 'table', + + 'Rpl_status' => 'repl', + 'Slave_' => 'repl', + + 'Tc_' => 'tc', + + 'Ssl_' => 'ssl', + + 'Open_files' => 'files', + 'Open_streams' => 'files', + 'Opened_files' => 'files', + ); + } + + /** + * Gets the sections for constructor + * + * @return array + */ + private function _getSections() + { + return array( + // section => section name (description) + 'com' => 'Com', + 'query' => __('SQL query'), + 'innodb' => 'InnoDB', + 'ndb' => 'NDB', + 'handler' => __('Handler'), + 'qcache' => __('Query cache'), + 'threads' => __('Threads'), + 'binlog_cache' => __('Binary log'), + 'created_tmp' => __('Temporary data'), + 'delayed' => __('Delayed inserts'), + 'key' => __('Key cache'), + 'select' => __('Joins'), + 'repl' => __('Replication'), + 'sort' => __('Sorting'), + 'table' => __('Tables'), + 'tc' => __('Transaction coordinator'), + 'files' => __('Files'), + 'ssl' => 'SSL', + 'other' => __('Other') + ); + } + + /** + * Gets the links for constructor + * + * @return array + */ + private function _getLinks() + { + $links = array(); + // variable or section name => (name => url) + + $links['table'][__('Flush (close) all tables')] = $this->selfUrl + . PMA_URL_getCommon( + array( + 'flush' => 'TABLES' + ) + ); + $links['table'][__('Show open tables')] + = 'sql.php' . PMA_URL_getCommon( + array( + 'sql_query' => 'SHOW OPEN TABLES', + 'goto' => $this->selfUrl, + ) + ); + + if ($GLOBALS['replication_info']['master']['status']) { + $links['repl'][__('Show slave hosts')] + = 'sql.php' . PMA_URL_getCommon( + array( + 'sql_query' => 'SHOW SLAVE HOSTS', + 'goto' => $this->selfUrl, + ) + ); + $links['repl'][__('Show master status')] = '#replication_master'; + } + if ($GLOBALS['replication_info']['slave']['status']) { + $links['repl'][__('Show slave status')] = '#replication_slave'; + } + + $links['repl']['doc'] = 'replication'; + + $links['qcache'][__('Flush query cache')] + = $this->selfUrl + . PMA_URL_getCommon( + array( + 'flush' => 'QUERY CACHE' + ) + ); + $links['qcache']['doc'] = 'query_cache'; + + $links['threads']['doc'] = 'mysql_threads'; + + $links['key']['doc'] = 'myisam_key_cache'; + + $links['binlog_cache']['doc'] = 'binary_log'; + + $links['Slow_queries']['doc'] = 'slow_query_log'; + + $links['innodb'][__('Variables')] + = 'server_engines.php?engine=InnoDB&' + . PMA_URL_getCommon(array(), 'html', ''); + $links['innodb'][__('InnoDB Status')] + = 'server_engines.php' + . PMA_URL_getCommon( + array( + 'engine' => 'InnoDB', + 'page' => 'Status' + ) + ); + $links['innodb']['doc'] = 'innodb'; + + return($links); + } + /** * Constructor */ @@ -136,140 +294,14 @@ class PMA_ServerStatusData /** * split variables in sections */ - $allocations = array( - // variable name => section - // variable names match when they begin with the given string + $allocations = $this->_getAllocations(); - 'Com_' => 'com', - 'Innodb_' => 'innodb', - 'Ndb_' => 'ndb', - 'Handler_' => 'handler', - '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', - 'Queries' => 'query', - 'Prepared_stmt_count' => 'query', - - 'Select_' => 'select', - 'Sort_' => 'sort', - - 'Open_tables' => 'table', - 'Opened_tables' => 'table', - 'Open_table_definitions' => 'table', - 'Opened_table_definitions' => 'table', - 'Table_locks_' => 'table', - - 'Rpl_status' => 'repl', - 'Slave_' => 'repl', - - 'Tc_' => 'tc', - - 'Ssl_' => 'ssl', - - 'Open_files' => 'files', - 'Open_streams' => 'files', - 'Opened_files' => 'files', - ); - - $sections = array( - // section => section name (description) - 'com' => 'Com', - 'query' => __('SQL query'), - 'innodb' => 'InnoDB', - 'ndb' => 'NDB', - 'handler' => __('Handler'), - 'qcache' => __('Query cache'), - 'threads' => __('Threads'), - 'binlog_cache' => __('Binary log'), - 'created_tmp' => __('Temporary data'), - 'delayed' => __('Delayed inserts'), - 'key' => __('Key cache'), - 'select' => __('Joins'), - 'repl' => __('Replication'), - 'sort' => __('Sorting'), - 'table' => __('Tables'), - 'tc' => __('Transaction coordinator'), - 'files' => __('Files'), - 'ssl' => 'SSL', - 'other' => __('Other') - ); + $sections = $this->_getSections(); /** * define some needful links/commands */ - // variable or section name => (name => url) - $links = array(); - - $links['table'][__('Flush (close) all tables')] = $this->selfUrl - . PMA_URL_getCommon( - array( - 'flush' => 'TABLES' - ) - ); - $links['table'][__('Show open tables')] - = 'sql.php' . PMA_URL_getCommon( - array( - 'sql_query' => 'SHOW OPEN TABLES', - 'goto' => $this->selfUrl, - ) - ); - - if ($GLOBALS['replication_info']['master']['status']) { - $links['repl'][__('Show slave hosts')] - = 'sql.php' . PMA_URL_getCommon( - array( - 'sql_query' => 'SHOW SLAVE HOSTS', - 'goto' => $this->selfUrl, - ) - ); - $links['repl'][__('Show master status')] = '#replication_master'; - } - if ($GLOBALS['replication_info']['slave']['status']) { - $links['repl'][__('Show slave status')] = '#replication_slave'; - } - - $links['repl']['doc'] = 'replication'; - - $links['qcache'][__('Flush query cache')] - = $this->selfUrl - . PMA_URL_getCommon( - array( - 'flush' => 'QUERY CACHE' - ) - ); - $links['qcache']['doc'] = 'query_cache'; - - $links['threads']['doc'] = 'mysql_threads'; - - $links['key']['doc'] = 'myisam_key_cache'; - - $links['binlog_cache']['doc'] = 'binary_log'; - - $links['Slow_queries']['doc'] = 'slow_query_log'; - - $links['innodb'][__('Variables')] - = 'server_engines.php?engine=InnoDB&' - . PMA_URL_getCommon(array(), 'html', ''); - $links['innodb'][__('InnoDB Status')] - = 'server_engines.php' - . PMA_URL_getCommon( - array( - 'engine' => 'InnoDB', - 'page' => 'Status' - ) - ); - $links['innodb']['doc'] = 'innodb'; + $links = $this->_getLinks(); // Variable to contain all com_ variables (query statistics) $used_queries = array(); From 347dc70c18aa4d036821db3ea379068b338952d8 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Tue, 2 Jun 2015 08:13:41 -0400 Subject: [PATCH 2/2] bug #4908 Reverse proxy: infinite internal redirect (added warning in doc) Signed-off-by: Marc Delisle --- ChangeLog | 1 + doc/config.rst | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 29f8b4d23b..7bac4ee47e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ phpMyAdmin - ChangeLog - bug #4931 False error before entering reCAPTCHA - bug #4909 central column with multiple server - bug #4937 Custom export with backquotes off is not working +- bug #4908 Reverse proxy: infinite internal redirect (added warning in doc) 4.4.8.0 (2015-05-28) - bug Allow accessing visual query builder when pmadb is not configured diff --git a/doc/config.rst b/doc/config.rst index ac3ef32e40..6d8ed5104a 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -1190,7 +1190,8 @@ Generic settings :type: boolean :default: false - Whether to force using https while accessing phpMyAdmin. + Whether to force using https while accessing phpMyAdmin. In a reverse + proxy setup, setting this to ``true`` is not supported. .. note::