mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-12 19:54:12 +02:00
[ticket/10748] Replace direct creations of tools();
PHPBB3-10748
This commit is contained in:
@@ -49,7 +49,10 @@ $classes = $finder->core_path('phpbb/')
|
||||
->get_classes();
|
||||
|
||||
$db = new \phpbb\db\driver\sqlite();
|
||||
$schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, new \phpbb\db\tools\tools($db, true), $phpbb_root_path, $phpEx, $table_prefix);
|
||||
$factory = new \phpbb\db\tools\factory();
|
||||
$db_tools = $factory->get($db, true);
|
||||
|
||||
$schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix);
|
||||
$schema_data = $schema_generator->get_schema();
|
||||
|
||||
$fp = fopen($schema_path . 'schema.json', 'wb');
|
||||
|
@@ -67,7 +67,10 @@ $classes = $finder->core_path('phpbb/')
|
||||
->directory('/db/migration/data')
|
||||
->get_classes();
|
||||
|
||||
$schema_generator = new \phpbb\db\migration\schema_generator($classes, $config, $db, new \phpbb\db\tools\tools($db, true), $phpbb_root_path, $phpEx, $table_prefix);
|
||||
$factory = new \phpbb\db\tools\factory();
|
||||
$db_tools = $factory->get($db, true);
|
||||
|
||||
$schema_generator = new \phpbb\db\migration\schema_generator($classes, $config, $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix);
|
||||
$schema_data = $schema_generator->get_schema();
|
||||
$dbms_type_map = \phpbb\db\tools\tools::get_dbms_type_map();
|
||||
|
||||
|
@@ -26,10 +26,10 @@ class acp_database
|
||||
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $cache, $db, $user, $auth, $template, $table_prefix, $request;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_log;
|
||||
global $cache, $db, $user, $template, $table_prefix, $request;
|
||||
global $phpbb_root_path, $phpbb_container, $phpbb_log;
|
||||
|
||||
$this->db_tools = new \phpbb\db\tools\tools($db);
|
||||
$this->db_tools = $phpbb_container->get('dbal.tools');
|
||||
|
||||
$user->add_lang('acp/database');
|
||||
|
||||
|
@@ -188,7 +188,8 @@ function dbms_select($default = '', $only_20x_options = false)
|
||||
*/
|
||||
function get_tables(&$db)
|
||||
{
|
||||
$db_tools = new \phpbb\db\tools\tools($db);
|
||||
$factory = new \phpbb\db\tools\factory();
|
||||
$db_tools = $factory->get($db);
|
||||
|
||||
return $db_tools->sql_list_tables();
|
||||
}
|
||||
|
@@ -1926,7 +1926,9 @@ function phpbb_check_username_collisions()
|
||||
function phpbb_convert_timezone($timezone)
|
||||
{
|
||||
global $config, $db, $phpbb_root_path, $phpEx, $table_prefix;
|
||||
$timezone_migration = new \phpbb\db\migration\data\v310\timezone($config, $db, new \phpbb\db\tools\tools($db), $phpbb_root_path, $phpEx, $table_prefix);
|
||||
|
||||
$factory = new \phpbb\db\tools\factory();
|
||||
$timezone_migration = new \phpbb\db\migration\data\v310\timezone($config, $db, $factory->get($db), $phpbb_root_path, $phpEx, $table_prefix);
|
||||
return $timezone_migration->convert_phpbb30_timezone($timezone, 0);
|
||||
}
|
||||
|
||||
|
@@ -1200,7 +1200,9 @@ class install_install extends module
|
||||
->get_classes();
|
||||
|
||||
$sqlite_db = new \phpbb\db\driver\sqlite();
|
||||
$schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $sqlite_db, new \phpbb\db\tools\tools($sqlite_db, true), $phpbb_root_path, $phpEx, $table_prefix);
|
||||
$factory = new \phpbb\db\tools\factory();
|
||||
$db_tools = $factory->get($sqlite_db, true);
|
||||
$schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $sqlite_db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix);
|
||||
$db_table_schema = $schema_generator->get_schema();
|
||||
}
|
||||
|
||||
@@ -1212,7 +1214,8 @@ class install_install extends module
|
||||
define('CONFIG_TABLE', $data['table_prefix'] . 'config');
|
||||
}
|
||||
|
||||
$db_tools = new \phpbb\db\tools\tools($db);
|
||||
$factory = new \phpbb\db\tools\factory();
|
||||
$db_tools = $factory->get($db);
|
||||
foreach ($db_table_schema as $table_name => $table_data)
|
||||
{
|
||||
$db_tools->sql_create_table(
|
||||
|
@@ -113,9 +113,9 @@ class qa
|
||||
*/
|
||||
public function is_installed()
|
||||
{
|
||||
global $db;
|
||||
global $phpbb_container;
|
||||
|
||||
$db_tool = new \phpbb\db\tools\tools($db);
|
||||
$db_tool = $phpbb_container->get('dbal.tools');
|
||||
|
||||
return $db_tool->sql_table_exists($this->table_captcha_questions);
|
||||
}
|
||||
@@ -306,11 +306,9 @@ class qa
|
||||
*/
|
||||
function install()
|
||||
{
|
||||
global $db;
|
||||
global $phpbb_container;
|
||||
|
||||
$db_tool = new \phpbb\db\tools\tools($db);
|
||||
|
||||
$tables = array($this->table_captcha_questions, $this->table_captcha_answers, $this->table_qa_confirm);
|
||||
$db_tool = $phpbb_container->get('dbal.tools');
|
||||
|
||||
$schemas = array(
|
||||
$this->table_captcha_questions => array (
|
||||
@@ -352,7 +350,7 @@ class qa
|
||||
),
|
||||
);
|
||||
|
||||
foreach($schemas as $table => $schema)
|
||||
foreach ($schemas as $table => $schema)
|
||||
{
|
||||
if (!$db_tool->sql_table_exists($table))
|
||||
{
|
||||
|
@@ -136,7 +136,8 @@ class fulltext_sphinx
|
||||
$this->auth = $auth;
|
||||
|
||||
// Initialize \phpbb\db\tools\tools object
|
||||
$this->db_tools = new \phpbb\db\tools\tools($this->db);
|
||||
global $phpbb_container; // TODO inject into object
|
||||
$this->db_tools = $phpbb_container->get('dbal.tools');
|
||||
|
||||
if(!$this->config['fulltext_sphinx_id'])
|
||||
{
|
||||
|
Reference in New Issue
Block a user