From ec90f2b380a598a3dbf7ada0e95878d9d1b85cbe Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 6 Dec 2014 16:34:02 +0100 Subject: [PATCH] [ticket/13421] Move tools to subdirectory PHPBB3-13421 --- phpBB/config/default/container/services_db.yml | 2 +- phpBB/develop/create_schema_files.php | 4 ++-- phpBB/develop/mysql_upgrader.php | 4 ++-- phpBB/includes/acp/acp_database.php | 2 +- phpBB/includes/functions_install.php | 2 +- phpBB/install/convertors/functions_phpbb20.php | 2 +- phpBB/install/install_install.php | 4 ++-- phpBB/phpbb/captcha/plugins/qa.php | 4 ++-- phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php | 2 +- phpBB/phpbb/db/migration/migration.php | 6 +++--- phpBB/phpbb/db/migration/schema_generator.php | 4 ++-- phpBB/phpbb/db/migrator.php | 4 ++-- phpBB/phpbb/db/{ => tools}/tools.php | 2 +- phpBB/phpbb/db/{ => tools}/tools_interface.php | 2 +- phpBB/phpbb/search/fulltext_sphinx.php | 6 +++--- tests/dbal/auto_increment_test.php | 2 +- tests/dbal/db_tools_test.php | 8 ++++---- tests/dbal/migrator_test.php | 2 +- tests/extension/manager_test.php | 2 +- tests/extension/metadata_manager_test.php | 2 +- tests/migrator/convert_timezones_test.php | 6 +++--- tests/migrator/schema_generator_test.php | 2 +- tests/notification/convert_test.php | 2 +- tests/test_framework/phpbb_database_test_case.php | 2 +- .../phpbb_database_test_connection_manager.php | 4 ++-- tests/test_framework/phpbb_functional_test_case.php | 2 +- 26 files changed, 42 insertions(+), 42 deletions(-) rename phpBB/phpbb/db/{ => tools}/tools.php (99%) rename phpBB/phpbb/db/{ => tools}/tools_interface.php (99%) diff --git a/phpBB/config/default/container/services_db.yml b/phpBB/config/default/container/services_db.yml index b3f1b485ea8..77a1b59d227 100644 --- a/phpBB/config/default/container/services_db.yml +++ b/phpBB/config/default/container/services_db.yml @@ -10,7 +10,7 @@ services: - [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]] dbal.tools: - class: phpbb\db\tools + class: phpbb\db\tools\tools arguments: - @dbal.conn diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 7ef86ad7fc9..e4102a02e7d 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -49,9 +49,9 @@ ->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($db, true), $phpbb_root_path, $phpEx, $table_prefix); +$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); $schema_data = $schema_generator->get_schema(); -$dbms_type_map = phpbb\db\tools::get_dbms_type_map(); +$dbms_type_map = phpbb\db\tools\tools::get_dbms_type_map(); $fp = fopen($schema_path . 'schema.json', 'wb'); fwrite($fp, json_encode($schema_data, JSON_PRETTY_PRINT)); diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index 5c558f0b8e7..ff4e38fb0a1 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -63,9 +63,9 @@ @set_time_limit(0); require($phpbb_root_path . 'includes/db/schema_data.' . $phpEx); -require($phpbb_root_path . 'phpbb/db/tools.' . $phpEx); +require($phpbb_root_path . 'phpbb/db/tools/tools.' . $phpEx); -$dbms_type_map = phpbb\db\tools::get_dbms_type_map(); +$dbms_type_map = phpbb\db\tools\tools::get_dbms_type_map(); foreach ($schema_data as $table_name => $table_data) { diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 0c52f824593..7de108c88a8 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -29,7 +29,7 @@ function main($id, $mode) global $cache, $db, $user, $auth, $template, $table_prefix; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; - $this->db_tools = new \phpbb\db\tools($db); + $this->db_tools = new \phpbb\db\tools\tools($db); $user->add_lang('acp/database'); diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index a60ddd40c5f..956e5a5180e 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -188,7 +188,7 @@ function dbms_select($default = '', $only_20x_options = false) */ function get_tables(&$db) { - $db_tools = new \phpbb\db\tools($db); + $db_tools = new \phpbb\db\tools\tools($db); return $db_tools->sql_list_tables(); } diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index 817c0072749..7794b5ca673 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -1926,7 +1926,7 @@ 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($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); return $timezone_migration->convert_phpbb30_timezone($timezone, 0); } diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 103262b5168..4ef6df172a2 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1197,7 +1197,7 @@ function load_schema($mode, $sub) ->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($sqlite_db, true), $phpbb_root_path, $phpEx, $table_prefix); + $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); $db_table_schema = $schema_generator->get_schema(); } @@ -1209,7 +1209,7 @@ function load_schema($mode, $sub) define('CONFIG_TABLE', $data['table_prefix'] . 'config'); } - $db_tools = new \phpbb\db\tools($db); + $db_tools = new \phpbb\db\tools\tools($db); foreach ($db_table_schema as $table_name => $table_data) { $db_tools->sql_create_table( diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php index a7ba994cc3c..ca242a96dc6 100644 --- a/phpBB/phpbb/captcha/plugins/qa.php +++ b/phpBB/phpbb/captcha/plugins/qa.php @@ -115,7 +115,7 @@ public function is_installed() { global $db; - $db_tool = new \phpbb\db\tools($db); + $db_tool = new \phpbb\db\tools\tools($db); return $db_tool->sql_table_exists($this->table_captcha_questions); } @@ -308,7 +308,7 @@ function install() { global $db; - $db_tool = new \phpbb\db\tools($db); + $db_tool = new \phpbb\db\tools\tools($db); $tables = array($this->table_captcha_questions, $this->table_captcha_answers, $this->table_qa_confirm); diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php index 06e46d522fd..5f928df47c9 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php @@ -34,7 +34,7 @@ public function update_schema() // this column was removed from the database updater // after 3.0.9-RC3 was released. It might still exist // in 3.0.9-RCX installations and has to be dropped as - // soon as the db_tools class is capable of properly + // soon as the \phpbb\db\tools\tools class is capable of properly // removing a primary key. // 'attempt_id' => array('UINT', NULL, 'auto_increment'), 'attempt_ip' => array('VCHAR:40', ''), diff --git a/phpBB/phpbb/db/migration/migration.php b/phpBB/phpbb/db/migration/migration.php index 6cf76853506..2304c8e44c9 100644 --- a/phpBB/phpbb/db/migration/migration.php +++ b/phpBB/phpbb/db/migration/migration.php @@ -28,7 +28,7 @@ abstract class migration /** @var \phpbb\db\driver\driver_interface */ protected $db; - /** @var \phpbb\db\tools_interface */ + /** @var \phpbb\db\tools\tools_interface */ protected $db_tools; /** @var string */ @@ -51,12 +51,12 @@ abstract class migration * * @param \phpbb\config\config $config * @param \phpbb\db\driver\driver_interface $db - * @param \phpbb\db\tools_interface $db_tools + * @param \phpbb\db\tools\tools_interface $db_tools * @param string $phpbb_root_path * @param string $php_ext * @param string $table_prefix */ - public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools_interface $db_tools, $phpbb_root_path, $php_ext, $table_prefix) + public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools\tools_interface $db_tools, $phpbb_root_path, $php_ext, $table_prefix) { $this->config = $config; $this->db = $db; diff --git a/phpBB/phpbb/db/migration/schema_generator.php b/phpBB/phpbb/db/migration/schema_generator.php index 91d8307d913..7003844bc4e 100644 --- a/phpBB/phpbb/db/migration/schema_generator.php +++ b/phpBB/phpbb/db/migration/schema_generator.php @@ -24,7 +24,7 @@ class schema_generator /** @var \phpbb\db\driver\driver_interface */ protected $db; - /** @var \phpbb\db\tools */ + /** @var \phpbb\db\tools\tools_interface */ protected $db_tools; /** @var array */ @@ -48,7 +48,7 @@ class schema_generator /** * Constructor */ - public function __construct(array $class_names, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools $db_tools, $phpbb_root_path, $php_ext, $table_prefix) + public function __construct(array $class_names, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools\tools_interface $db_tools, $phpbb_root_path, $php_ext, $table_prefix) { $this->config = $config; $this->db = $db; diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index c0d42ab6acf..bb79c0dd68f 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -24,7 +24,7 @@ class migrator /** @var \phpbb\db\driver\driver_interface */ protected $db; - /** @var \phpbb\db\tools_interface */ + /** @var \phpbb\db\tools\tools_interface */ protected $db_tools; /** @var \phpbb\db\migration\helper */ @@ -84,7 +84,7 @@ class migrator /** * Constructor of the database migrator */ - public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools_interface $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools, \phpbb\db\migration\helper $helper) + public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools\tools_interface $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools, \phpbb\db\migration\helper $helper) { $this->config = $config; $this->db = $db; diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools/tools.php similarity index 99% rename from phpBB/phpbb/db/tools.php rename to phpBB/phpbb/db/tools/tools.php index e9d23829109..63c43c07ef7 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools/tools.php @@ -11,7 +11,7 @@ * */ -namespace phpbb\db; +namespace phpbb\db\tools; /** * Database Tools for handling cross-db actions such as altering columns, etc. diff --git a/phpBB/phpbb/db/tools_interface.php b/phpBB/phpbb/db/tools/tools_interface.php similarity index 99% rename from phpBB/phpbb/db/tools_interface.php rename to phpBB/phpbb/db/tools/tools_interface.php index d0ecac779ec..f153f73a54e 100644 --- a/phpBB/phpbb/db/tools_interface.php +++ b/phpBB/phpbb/db/tools/tools_interface.php @@ -11,7 +11,7 @@ * */ -namespace phpbb\db; +namespace phpbb\db\tools; /** * Interface for a Database Tools for handling cross-db actions such as altering columns, etc. diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index 7be1b487ab1..2765d05b94f 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -85,7 +85,7 @@ class fulltext_sphinx /** * Database Tools object - * @var \phpbb\db\tools_interface + * @var \phpbb\db\tools\tools_interface */ protected $db_tools; @@ -135,8 +135,8 @@ public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $ $this->db = $db; $this->auth = $auth; - // Initialize \phpbb\db\tools object - $this->db_tools = new \phpbb\db\tools($this->db); + // Initialize \phpbb\db\tools\tools object + $this->db_tools = new \phpbb\db\tools\tools($this->db); if(!$this->config['fulltext_sphinx_id']) { diff --git a/tests/dbal/auto_increment_test.php b/tests/dbal/auto_increment_test.php index 1ed8ea29e39..057bcb5bac1 100644 --- a/tests/dbal/auto_increment_test.php +++ b/tests/dbal/auto_increment_test.php @@ -30,7 +30,7 @@ protected function setUp() parent::setUp(); $this->db = $this->new_dbal(); - $this->tools = new \phpbb\db\tools($this->db); + $this->tools = new \phpbb\db\tools\tools($this->db); $this->table_data = array( 'COLUMNS' => array( diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index d34a2249ef4..7d01376062d 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -17,7 +17,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case { /** @var \phpbb\db\driver\driver_interface */ protected $db; - /** @var \phpbb\db\tools_interface */ + /** @var \phpbb\db\tools\tools_interface */ protected $tools; protected $table_exists; protected $table_data; @@ -32,7 +32,7 @@ protected function setUp() parent::setUp(); $this->db = $this->new_dbal(); - $this->tools = new \phpbb\db\tools($this->db); + $this->tools = new \phpbb\db\tools\tools($this->db); $this->table_data = array( 'COLUMNS' => array( @@ -340,7 +340,7 @@ public function test_table_drop() public function test_perform_schema_changes_drop_tables() { - $db_tools = $this->getMock('\phpbb\db\tools', array( + $db_tools = $this->getMock('\phpbb\db\tools\tools', array( 'sql_table_exists', 'sql_table_drop', ), array(&$this->db)); @@ -366,7 +366,7 @@ public function test_perform_schema_changes_drop_tables() public function test_perform_schema_changes_drop_columns() { - $db_tools = $this->getMock('\phpbb\db\tools', array( + $db_tools = $this->getMock('\phpbb\db\tools\tools', array( 'sql_column_exists', 'sql_column_remove', ), array(&$this->db)); diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php index 10a9444d63d..e4fb442818e 100644 --- a/tests/dbal/migrator_test.php +++ b/tests/dbal/migrator_test.php @@ -38,7 +38,7 @@ public function setUp() parent::setUp(); $this->db = $this->new_dbal(); - $this->db_tools = new \phpbb\db\tools($this->db); + $this->db_tools = new \phpbb\db\tools\tools($this->db); $this->config = new \phpbb\config\db($this->db, new phpbb_mock_cache, 'phpbb_config'); diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php index 5c7cad89f64..ab93edd9391 100644 --- a/tests/extension/manager_test.php +++ b/tests/extension/manager_test.php @@ -150,7 +150,7 @@ protected function create_extension_manager($with_cache = true) $config = new \phpbb\config\config(array('version' => PHPBB_VERSION)); $db = $this->new_dbal(); - $db_tools = new \phpbb\db\tools($db); + $db_tools = new \phpbb\db\tools\tools($db); $phpbb_root_path = __DIR__ . './../../phpBB/'; $php_ext = 'php'; $table_prefix = 'phpbb_'; diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index b7a6cd3c5bf..2d6df3a3f38 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -41,7 +41,7 @@ protected function setUp() 'version' => '3.1.0', )); $this->db = $this->new_dbal(); - $this->db_tools = new \phpbb\db\tools($this->db); + $this->db_tools = new \phpbb\db\tools\tools($this->db); $this->phpbb_root_path = dirname(__FILE__) . '/'; $this->phpEx = 'php'; $this->user = new \phpbb\user('\phpbb\datetime'); diff --git a/tests/migrator/convert_timezones_test.php b/tests/migrator/convert_timezones_test.php index 7501ed2ed0d..80a43b40356 100644 --- a/tests/migrator/convert_timezones_test.php +++ b/tests/migrator/convert_timezones_test.php @@ -18,7 +18,7 @@ class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case public function getDataSet() { $this->db = $this->new_dbal(); - $db_tools = new \phpbb\db\tools($this->db); + $db_tools = new \phpbb\db\tools\tools($this->db); // user_dst doesn't exist anymore, must re-add it to test this $db_tools->sql_column_add('phpbb_users', 'user_dst', array('BOOL', 1)); @@ -59,7 +59,7 @@ protected function setUp() $this->migration = new \phpbb\db\migration\data\v310\timezone( new \phpbb\config\config(array()), $this->db, - new \phpbb\db\tools($this->db), + new \phpbb\db\tools\tools($this->db), $phpbb_root_path, $phpEx, 'phpbb_' @@ -90,7 +90,7 @@ public function test_convert() } $this->db->sql_freeresult($result); - $db_tools = new \phpbb\db\tools($this->db); + $db_tools = new \phpbb\db\tools\tools($this->db); // Remove the user_dst field again $db_tools->sql_column_remove('phpbb_users', 'user_dst'); diff --git a/tests/migrator/schema_generator_test.php b/tests/migrator/schema_generator_test.php index 9adf518a5d3..1e3b489426c 100644 --- a/tests/migrator/schema_generator_test.php +++ b/tests/migrator/schema_generator_test.php @@ -30,7 +30,7 @@ public function setUp() $this->config = new \phpbb\config\config(array()); $this->db = new \phpbb\db\driver\sqlite(); - $this->db_tools = new \phpbb\db\tools($this->db); + $this->db_tools = new \phpbb\db\tools\tools($this->db); $this->table_prefix = 'phpbb_'; } diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php index 32ab34c9bc9..ad6e5849d39 100644 --- a/tests/notification/convert_test.php +++ b/tests/notification/convert_test.php @@ -32,7 +32,7 @@ protected function setUp() $this->migration = new \phpbb\db\migration\data\v310\notification_options_reconvert( new \phpbb\config\config(array()), $this->db, - new \phpbb\db\tools($this->db), + new \phpbb\db\tools\tools($this->db), $phpbb_root_path, $phpEx, 'phpbb_' diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index fc1a3632f42..f630f4ab529 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -77,7 +77,7 @@ static public function setUpBeforeClass() global $table_prefix; $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($db, true), $phpbb_root_path, $phpEx, $table_prefix); + $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); file_put_contents(self::$schema_file, json_encode($schema_generator->get_schema())); } diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index 5d643e43e2e..ba641c6fb7e 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -370,11 +370,11 @@ protected function load_schema_from_file($directory, \phpbb\db\driver\driver_int ->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($db, true), $phpbb_root_path, $phpEx, $table_prefix); + $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); $db_table_schema = $schema_generator->get_schema(); } - $db_tools = new \phpbb\db\tools($db, true); + $db_tools = new \phpbb\db\tools\tools($db, true); foreach ($db_table_schema as $table_name => $table_data) { $queries = $db_tools->sql_create_table( diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 9391795e32d..0ea6c5b7cbe 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -230,7 +230,7 @@ protected function get_extension_manager() $config = new \phpbb\config\config(array()); $db = $this->get_db(); - $db_tools = new \phpbb\db\tools($db); + $db_tools = new \phpbb\db\tools\tools($db); $migrator = new \phpbb\db\migrator( $config,