From f58349481d0f7ae3793db4e0ebf83774ce1026c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 6 Apr 2016 10:13:40 +0200 Subject: [PATCH 1/2] Avoid destroying already initalized gettext variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- libraries/common.inc.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 09c7de5060..b84bc374d3 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -148,6 +148,8 @@ $variables_whitelist = array ( 'PMA_PHP_SELF', 'variables_whitelist', 'key', + /* gettext globals */ + 'text_domains', 'default_domain', 'LC_CATEGORIES', 'EMULATEGETTEXT', 'CURRENTLOCALE', ); foreach (get_defined_vars() as $key => $value) { From ec984877d827c72c614100c5fc4574c61fbd0b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 6 Apr 2016 10:17:56 +0200 Subject: [PATCH 2/2] Improve performance of database structure page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no need to get full list of tables twice, it's enough to do it in the controller itself. Fixes #12129 Signed-off-by: Michal Čihař --- ChangeLog | 1 + db_structure.php | 18 ------ .../database/DatabaseStructureController.php | 61 ++++++++----------- 3 files changed, 28 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index 14f58607cc..b59e582d9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ phpMyAdmin - ChangeLog - issue #12125 Cannot highlight a column if I scroll down from the top of the table - issue #12154 Fixed possible PHP error in SQL parser - issue #12029 Fixed SQL quoting in SQL export +- issue #12129 Improve performance of database structure page 4.6.0.0 (2016-03-22) + issue #11456 Disabled storage engines diff --git a/db_structure.php b/db_structure.php index 50f3ef80d9..4bdb9ccb2c 100644 --- a/db_structure.php +++ b/db_structure.php @@ -15,18 +15,6 @@ use PMA\libraries\Util; require_once 'libraries/common.inc.php'; require_once 'libraries/db_common.inc.php'; -list( - $tables, - $num_tables, - $total_num_tables, - $sub_part, - $is_show_stats, - $db_is_system_schema, - $tooltip_truename, - $tooltip_aliasname, - $pos -) = Util::getDbInfo($GLOBALS['db'], isset($sub_part) ? $sub_part : ''); - $container = libraries\di\Container::getDefaultContainer(); $container->factory('PMA\libraries\controllers\database\DatabaseStructureController'); $container->alias( @@ -36,16 +24,10 @@ $container->alias( $container->set('PMA\libraries\Response', Response::getInstance()); $container->alias('response', 'PMA\libraries\Response'); -global $db, $pos, $db_is_system_schema, $total_num_tables, $tables, $num_tables; /* Define dependencies for the concerned controller */ $dependency_definitions = array( 'db' => $db, 'url_query' => &$GLOBALS['url_query'], - 'pos' => $pos, - 'db_is_system_schema' => $db_is_system_schema, - 'num_tables' => $num_tables, - 'total_num_tables' => $total_num_tables, - 'tables' => $tables, ); /** @var DatabaseStructureController $controller */ diff --git a/libraries/controllers/database/DatabaseStructureController.php b/libraries/controllers/database/DatabaseStructureController.php index 9a59637770..59eab9860a 100644 --- a/libraries/controllers/database/DatabaseStructureController.php +++ b/libraries/controllers/database/DatabaseStructureController.php @@ -62,26 +62,40 @@ class DatabaseStructureController extends DatabaseController /** * DatabaseStructureController constructor * - * @param string $url_query URL query - * @param int $num_tables Number of tables - * @param int $pos Current position in the list - * @param bool $db_is_system_schema DB is information_schema - * @param int $total_num_tables Number of tables - * @param array $tables Tables in the DB - * @param bool $is_show_stats Whether stats show or not + * @param string $url_query URL query */ - public function __construct( - $url_query, $num_tables, $pos, $db_is_system_schema, - $total_num_tables, $tables, $is_show_stats - ) { + public function __construct($url_query) { parent::__construct(); $this->_url_query = $url_query; + } + + /** + * Retrieves databse information for further use + * + * @param string $sub_part Page part name + * + * @return void + */ + private function _getDbInfo($sub_part) + { + list( + $tables, + $num_tables, + $total_num_tables, + , + $is_show_stats, + $db_is_system_schema, + , + , + $pos + ) = Util::getDbInfo($GLOBALS['db'], $sub_part); + + $this->_tables = $tables; $this->_num_tables = $num_tables; $this->_pos = $pos; $this->_db_is_system_schema = $db_is_system_schema; $this->_total_num_tables = $total_num_tables; - $this->_tables = $tables; $this->_is_show_stats = $is_show_stats; } @@ -125,28 +139,7 @@ class DatabaseStructureController extends DatabaseController $this->_url_query .= '&goto=db_structure.php'; // Gets the database structure - $sub_part = '_structure'; - - list( - $tables, - $num_tables, - $total_num_tables, - , - $is_show_stats, - $db_is_system_schema, - , - , - $pos - ) = Util::getDbInfo($GLOBALS['db'], $sub_part); - - $this->_tables = $tables; - // updating $tables seems enough for #11376, but updating other - // variables too in case they may cause some other problem. - $this->_num_tables = $num_tables; - $this->_pos = $pos; - $this->_db_is_system_schema = $db_is_system_schema; - $this->_total_num_tables = $total_num_tables; - $this->_is_show_stats = $is_show_stats; + $this->_getDbInfo('_structure'); include_once 'libraries/replication.inc.php';