From 6036b948ff8ff02f890d46000aafea5dd157d025 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 30 May 2012 13:38:41 +0200 Subject: [PATCH 1/3] [ticket/10611] Generate db_tools instance in acp_database module. PHPBB3-10611 --- phpBB/includes/acp/acp_database.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 62bcd43a47..6380f221f8 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -21,6 +21,7 @@ if (!defined('IN_PHPBB')) */ class acp_database { + var $db_tools; var $u_action; function main($id, $mode) @@ -28,6 +29,12 @@ class acp_database global $cache, $db, $user, $auth, $template, $table_prefix; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + if (!class_exists('phpbb_db_tools')) + { + require($phpbb_root_path . 'includes/db/db_tools.' . $phpEx); + } + $this->db_tools = new phpbb_db_tools($db); + $user->add_lang('acp/database'); $this->tpl_name = 'acp_database'; From 515c27270fe04b5e2f69a0cedc5007ef889fdf77 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 30 May 2012 13:41:36 +0200 Subject: [PATCH 2/3] [ticket/10611] Use phpbb_db_tools::sql_list_tables() instead of get_tables(). get_tables() was deprecated by phpbb_db_tools::sql_list_tables() This prevents unnecessarily loading functions_install.php PHPBB3-10611 --- phpBB/includes/acp/acp_database.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 6380f221f8..885760f859 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -180,8 +180,7 @@ class acp_database break; default: - include($phpbb_root_path . 'includes/functions_install.' . $phpEx); - $tables = get_tables($db); + $tables = $this->db_tools->sql_list_tables(); asort($tables); foreach ($tables as $table_name) { From 9240ddbfa7cc4deb2076dcb989e6bfb318652e47 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 30 May 2012 13:45:00 +0200 Subject: [PATCH 3/3] [ticket/10611] Filter out not existing database tables when making a backup. Using $this->db_tools->sql_list_tables() as the first argument gives us table names as array keys as a by-product which might be useful at some point. PHPBB3-10611 --- phpBB/includes/acp/acp_database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 885760f859..758cd10434 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -57,7 +57,7 @@ class acp_database { case 'download': $type = request_var('type', ''); - $table = request_var('table', array('')); + $table = array_intersect($this->db_tools->sql_list_tables(), request_var('table', array(''))); $format = request_var('method', ''); $where = request_var('where', '');