[ticket/13421] Move tools to subdirectory

PHPBB3-13421
This commit is contained in:
Joas Schilling 2014-12-06 16:34:02 +01:00
parent d78bb2865b
commit ec90f2b380
26 changed files with 42 additions and 42 deletions

View file

@ -10,7 +10,7 @@ services:
- [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]] - [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]]
dbal.tools: dbal.tools:
class: phpbb\db\tools class: phpbb\db\tools\tools
arguments: arguments:
- @dbal.conn - @dbal.conn

View file

@ -49,9 +49,9 @@ $classes = $finder->core_path('phpbb/')
->get_classes(); ->get_classes();
$db = new \phpbb\db\driver\sqlite(); $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(); $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'); $fp = fopen($schema_path . 'schema.json', 'wb');
fwrite($fp, json_encode($schema_data, JSON_PRETTY_PRINT)); fwrite($fp, json_encode($schema_data, JSON_PRETTY_PRINT));

View file

@ -63,9 +63,9 @@ echo "USE $dbname;$newline$newline";
@set_time_limit(0); @set_time_limit(0);
require($phpbb_root_path . 'includes/db/schema_data.' . $phpEx); 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) foreach ($schema_data as $table_name => $table_data)
{ {

View file

@ -29,7 +29,7 @@ class acp_database
global $cache, $db, $user, $auth, $template, $table_prefix; global $cache, $db, $user, $auth, $template, $table_prefix;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; 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'); $user->add_lang('acp/database');

View file

@ -188,7 +188,7 @@ function dbms_select($default = '', $only_20x_options = false)
*/ */
function get_tables(&$db) 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(); return $db_tools->sql_list_tables();
} }

View file

@ -1926,7 +1926,7 @@ function phpbb_check_username_collisions()
function phpbb_convert_timezone($timezone) function phpbb_convert_timezone($timezone)
{ {
global $config, $db, $phpbb_root_path, $phpEx, $table_prefix; 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); return $timezone_migration->convert_phpbb30_timezone($timezone, 0);
} }

View file

@ -1197,7 +1197,7 @@ class install_install extends module
->get_classes(); ->get_classes();
$sqlite_db = new \phpbb\db\driver\sqlite(); $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(); $db_table_schema = $schema_generator->get_schema();
} }
@ -1209,7 +1209,7 @@ class install_install extends module
define('CONFIG_TABLE', $data['table_prefix'] . 'config'); 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) foreach ($db_table_schema as $table_name => $table_data)
{ {
$db_tools->sql_create_table( $db_tools->sql_create_table(

View file

@ -115,7 +115,7 @@ class qa
{ {
global $db; 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); return $db_tool->sql_table_exists($this->table_captcha_questions);
} }
@ -308,7 +308,7 @@ class qa
{ {
global $db; 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); $tables = array($this->table_captcha_questions, $this->table_captcha_answers, $this->table_qa_confirm);

View file

@ -34,7 +34,7 @@ class release_3_0_9_rc1 extends \phpbb\db\migration\migration
// this column was removed from the database updater // this column was removed from the database updater
// after 3.0.9-RC3 was released. It might still exist // after 3.0.9-RC3 was released. It might still exist
// in 3.0.9-RCX installations and has to be dropped as // 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. // removing a primary key.
// 'attempt_id' => array('UINT', NULL, 'auto_increment'), // 'attempt_id' => array('UINT', NULL, 'auto_increment'),
'attempt_ip' => array('VCHAR:40', ''), 'attempt_ip' => array('VCHAR:40', ''),

View file

@ -28,7 +28,7 @@ abstract class migration
/** @var \phpbb\db\driver\driver_interface */ /** @var \phpbb\db\driver\driver_interface */
protected $db; protected $db;
/** @var \phpbb\db\tools_interface */ /** @var \phpbb\db\tools\tools_interface */
protected $db_tools; protected $db_tools;
/** @var string */ /** @var string */
@ -51,12 +51,12 @@ abstract class migration
* *
* @param \phpbb\config\config $config * @param \phpbb\config\config $config
* @param \phpbb\db\driver\driver_interface $db * @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 $phpbb_root_path
* @param string $php_ext * @param string $php_ext
* @param string $table_prefix * @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->config = $config;
$this->db = $db; $this->db = $db;

View file

@ -24,7 +24,7 @@ class schema_generator
/** @var \phpbb\db\driver\driver_interface */ /** @var \phpbb\db\driver\driver_interface */
protected $db; protected $db;
/** @var \phpbb\db\tools */ /** @var \phpbb\db\tools\tools_interface */
protected $db_tools; protected $db_tools;
/** @var array */ /** @var array */
@ -48,7 +48,7 @@ class schema_generator
/** /**
* Constructor * 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->config = $config;
$this->db = $db; $this->db = $db;

View file

@ -24,7 +24,7 @@ class migrator
/** @var \phpbb\db\driver\driver_interface */ /** @var \phpbb\db\driver\driver_interface */
protected $db; protected $db;
/** @var \phpbb\db\tools_interface */ /** @var \phpbb\db\tools\tools_interface */
protected $db_tools; protected $db_tools;
/** @var \phpbb\db\migration\helper */ /** @var \phpbb\db\migration\helper */
@ -84,7 +84,7 @@ class migrator
/** /**
* Constructor of the database 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->config = $config;
$this->db = $db; $this->db = $db;

View file

@ -11,7 +11,7 @@
* *
*/ */
namespace phpbb\db; namespace phpbb\db\tools;
/** /**
* Database Tools for handling cross-db actions such as altering columns, etc. * Database Tools for handling cross-db actions such as altering columns, etc.

View file

@ -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. * Interface for a Database Tools for handling cross-db actions such as altering columns, etc.

View file

@ -85,7 +85,7 @@ class fulltext_sphinx
/** /**
* Database Tools object * Database Tools object
* @var \phpbb\db\tools_interface * @var \phpbb\db\tools\tools_interface
*/ */
protected $db_tools; protected $db_tools;
@ -135,8 +135,8 @@ class fulltext_sphinx
$this->db = $db; $this->db = $db;
$this->auth = $auth; $this->auth = $auth;
// Initialize \phpbb\db\tools object // Initialize \phpbb\db\tools\tools object
$this->db_tools = new \phpbb\db\tools($this->db); $this->db_tools = new \phpbb\db\tools\tools($this->db);
if(!$this->config['fulltext_sphinx_id']) if(!$this->config['fulltext_sphinx_id'])
{ {

View file

@ -30,7 +30,7 @@ class phpbb_dbal_auto_increment_test extends phpbb_database_test_case
parent::setUp(); parent::setUp();
$this->db = $this->new_dbal(); $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( $this->table_data = array(
'COLUMNS' => array( 'COLUMNS' => array(

View file

@ -17,7 +17,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
{ {
/** @var \phpbb\db\driver\driver_interface */ /** @var \phpbb\db\driver\driver_interface */
protected $db; protected $db;
/** @var \phpbb\db\tools_interface */ /** @var \phpbb\db\tools\tools_interface */
protected $tools; protected $tools;
protected $table_exists; protected $table_exists;
protected $table_data; protected $table_data;
@ -32,7 +32,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
parent::setUp(); parent::setUp();
$this->db = $this->new_dbal(); $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( $this->table_data = array(
'COLUMNS' => array( 'COLUMNS' => array(
@ -340,7 +340,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
public function test_perform_schema_changes_drop_tables() 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_exists',
'sql_table_drop', 'sql_table_drop',
), array(&$this->db)); ), array(&$this->db));
@ -366,7 +366,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
public function test_perform_schema_changes_drop_columns() 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_exists',
'sql_column_remove', 'sql_column_remove',
), array(&$this->db)); ), array(&$this->db));

View file

@ -38,7 +38,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
parent::setUp(); parent::setUp();
$this->db = $this->new_dbal(); $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'); $this->config = new \phpbb\config\db($this->db, new phpbb_mock_cache, 'phpbb_config');

View file

@ -150,7 +150,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$config = new \phpbb\config\config(array('version' => PHPBB_VERSION)); $config = new \phpbb\config\config(array('version' => PHPBB_VERSION));
$db = $this->new_dbal(); $db = $this->new_dbal();
$db_tools = new \phpbb\db\tools($db); $db_tools = new \phpbb\db\tools\tools($db);
$phpbb_root_path = __DIR__ . './../../phpBB/'; $phpbb_root_path = __DIR__ . './../../phpBB/';
$php_ext = 'php'; $php_ext = 'php';
$table_prefix = 'phpbb_'; $table_prefix = 'phpbb_';

View file

@ -41,7 +41,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
'version' => '3.1.0', 'version' => '3.1.0',
)); ));
$this->db = $this->new_dbal(); $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->phpbb_root_path = dirname(__FILE__) . '/';
$this->phpEx = 'php'; $this->phpEx = 'php';
$this->user = new \phpbb\user('\phpbb\datetime'); $this->user = new \phpbb\user('\phpbb\datetime');

View file

@ -18,7 +18,7 @@ class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case
public function getDataSet() public function getDataSet()
{ {
$this->db = $this->new_dbal(); $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 // 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)); $db_tools->sql_column_add('phpbb_users', 'user_dst', array('BOOL', 1));
@ -59,7 +59,7 @@ class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case
$this->migration = new \phpbb\db\migration\data\v310\timezone( $this->migration = new \phpbb\db\migration\data\v310\timezone(
new \phpbb\config\config(array()), new \phpbb\config\config(array()),
$this->db, $this->db,
new \phpbb\db\tools($this->db), new \phpbb\db\tools\tools($this->db),
$phpbb_root_path, $phpbb_root_path,
$phpEx, $phpEx,
'phpbb_' 'phpbb_'
@ -90,7 +90,7 @@ class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case
} }
$this->db->sql_freeresult($result); $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 // Remove the user_dst field again
$db_tools->sql_column_remove('phpbb_users', 'user_dst'); $db_tools->sql_column_remove('phpbb_users', 'user_dst');

View file

@ -30,7 +30,7 @@ class schema_generator_test extends phpbb_test_case
$this->config = new \phpbb\config\config(array()); $this->config = new \phpbb\config\config(array());
$this->db = new \phpbb\db\driver\sqlite(); $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_'; $this->table_prefix = 'phpbb_';
} }

View file

@ -32,7 +32,7 @@ class phpbb_notification_convert_test extends phpbb_database_test_case
$this->migration = new \phpbb\db\migration\data\v310\notification_options_reconvert( $this->migration = new \phpbb\db\migration\data\v310\notification_options_reconvert(
new \phpbb\config\config(array()), new \phpbb\config\config(array()),
$this->db, $this->db,
new \phpbb\db\tools($this->db), new \phpbb\db\tools\tools($this->db),
$phpbb_root_path, $phpbb_root_path,
$phpEx, $phpEx,
'phpbb_' 'phpbb_'

View file

@ -77,7 +77,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
global $table_prefix; global $table_prefix;
$db = new \phpbb\db\driver\sqlite(); $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())); file_put_contents(self::$schema_file, json_encode($schema_generator->get_schema()));
} }

View file

@ -370,11 +370,11 @@ class phpbb_database_test_connection_manager
->get_classes(); ->get_classes();
$db = new \phpbb\db\driver\sqlite(); $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_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) foreach ($db_table_schema as $table_name => $table_data)
{ {
$queries = $db_tools->sql_create_table( $queries = $db_tools->sql_create_table(

View file

@ -230,7 +230,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$config = new \phpbb\config\config(array()); $config = new \phpbb\config\config(array());
$db = $this->get_db(); $db = $this->get_db();
$db_tools = new \phpbb\db\tools($db); $db_tools = new \phpbb\db\tools\tools($db);
$migrator = new \phpbb\db\migrator( $migrator = new \phpbb\db\migrator(
$config, $config,