diff options
Diffstat (limited to 'phpBB/phpbb/db/migration/tool')
-rw-r--r-- | phpBB/phpbb/db/migration/tool/config.php | 14 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/tool/module.php | 34 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/tool/permission.php | 26 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/tool/tool_interface.php (renamed from phpBB/phpbb/db/migration/tool/interface.php) | 4 |
4 files changed, 43 insertions, 35 deletions
diff --git a/phpBB/phpbb/db/migration/tool/config.php b/phpBB/phpbb/db/migration/tool/config.php index 0b626bf455..f2149dc59a 100644 --- a/phpBB/phpbb/db/migration/tool/config.php +++ b/phpBB/phpbb/db/migration/tool/config.php @@ -7,22 +7,24 @@ * */ +namespace phpbb\db\migration\tool; + /** * Migration config tool * * @package db */ -class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interface +class config implements \phpbb\db\migration\tool\tool_interface { - /** @var phpbb_config */ + /** @var \phpbb\config\config */ protected $config; /** * Constructor * - * @param phpbb_config $config + * @param \phpbb\config\config $config */ - public function __construct(phpbb_config $config) + public function __construct(\phpbb\config\config $config) { $this->config = $config; } @@ -67,7 +69,7 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interfac { if (!isset($this->config[$config_name])) { - throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name); + throw new \phpbb\db\migration\exception('CONFIG_NOT_EXIST', $config_name); } $this->config->set($config_name, $config_value); @@ -88,7 +90,7 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interfac { if (!isset($this->config[$config_name])) { - throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name); + throw new \phpbb\db\migration\exception('CONFIG_NOT_EXIST', $config_name); } $this->config->set_atomic($config_name, $compare, $config_value); diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index ac4d2c9bd7..9869dd4230 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -7,20 +7,22 @@ * */ +namespace phpbb\db\migration\tool; + /** * Migration module management tool * * @package db */ -class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interface +class module implements \phpbb\db\migration\tool\tool_interface { - /** @var phpbb_cache_service */ + /** @var \phpbb\cache\service */ protected $cache; /** @var dbal */ protected $db; - /** @var phpbb_user */ + /** @var \phpbb\user */ protected $user; /** @var string */ @@ -35,14 +37,14 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac /** * Constructor * - * @param phpbb_db_driver $db + * @param \phpbb\db\driver\driver $db * @param mixed $cache - * @param phpbb_user $user + * @param \phpbb\user $user * @param string $phpbb_root_path * @param string $php_ext * @param string $modules_table */ - public function __construct(phpbb_db_driver $db, phpbb_cache_service $cache, phpbb_user $user, $phpbb_root_path, $php_ext, $modules_table) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\service $cache, \phpbb\user $user, $phpbb_root_path, $php_ext, $modules_table) { $this->db = $db; $this->cache = $cache; @@ -133,7 +135,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac * * @param string $class The module class(acp|mcp|ucp) * @param int|string $parent The parent module_id|module_langname (0 for no parent) - * @param array $data an array of the data on the new module. + * @param array $data an array of the data on the new \module. * This can be setup in two different ways. * 1. The "manual" way. For inserting a category or one at a time. * It will be merged with the base array shown a bit below, @@ -221,14 +223,14 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac if (!$module_id) { - throw new phpbb_db_migration_exception('MODULE_NOT_EXIST', $parent); + throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent); } $parent = $data['parent_id'] = $module_id; } else if (!$this->exists($class, false, $parent)) { - throw new phpbb_db_migration_exception('MODULE_NOT_EXIST', $parent); + throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent); } if ($this->exists($class, $parent, $data['module_langname'])) @@ -241,7 +243,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext); $this->user->add_lang('acp/modules'); } - $acp_modules = new acp_modules(); + $acp_modules = new \acp_modules(); $module_data = array( 'module_enabled' => (isset($data['module_enabled'])) ? $data['module_enabled'] : 1, @@ -259,7 +261,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac if (is_string($result)) { // Error - throw new phpbb_db_migration_exception('MODULE_ERROR', $result); + throw new \phpbb\db\migration\exception('MODULE_ERROR', $result); } else { @@ -347,7 +349,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac // Failed. if (!isset($module['module_basename'])) { - throw new phpbb_db_migration_exception('MODULE_NOT_EXIST'); + throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST'); } // Automatic method @@ -433,7 +435,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext); $this->user->add_lang('acp/modules'); } - $acp_modules = new acp_modules(); + $acp_modules = new \acp_modules(); $acp_modules->module_class = $class; foreach ($module_ids as $module_id) @@ -476,7 +478,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac } /** - * Wrapper for acp_modules::get_module_infos() + * Wrapper for \acp_modules::get_module_infos() * * @param string $class Module Class * @param string $basename Module Basename @@ -488,12 +490,12 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac { include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext); } - $acp_modules = new acp_modules(); + $acp_modules = new \acp_modules(); $module = $acp_modules->get_module_infos($basename, $class, true); if (empty($module)) { - throw new phpbb_db_migration_exception('MODULE_INFO_FILE_NOT_EXIST', $class, $basename); + throw new \phpbb\db\migration\exception('MODULE_INFO_FILE_NOT_EXIST', $class, $basename); } return array_pop($module); diff --git a/phpBB/phpbb/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php index 2f09c0ac72..fd2de9c8fb 100644 --- a/phpBB/phpbb/db/migration/tool/permission.php +++ b/phpBB/phpbb/db/migration/tool/permission.php @@ -7,17 +7,19 @@ * */ +namespace phpbb\db\migration\tool; + /** * Migration permission management tool * * @package db */ -class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_interface +class permission implements \phpbb\db\migration\tool\tool_interface { - /** @var phpbb_auth */ + /** @var \phpbb\auth\auth */ protected $auth; - /** @var phpbb_cache_service */ + /** @var \phpbb\cache\service */ protected $cache; /** @var dbal */ @@ -32,13 +34,13 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte /** * Constructor * - * @param phpbb_db_driver $db + * @param \phpbb\db\driver\driver $db * @param mixed $cache - * @param phpbb_auth $auth + * @param \phpbb\auth\auth $auth * @param string $phpbb_root_path * @param string $php_ext */ - public function __construct(phpbb_db_driver $db, phpbb_cache_service $cache, phpbb_auth $auth, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\service $cache, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext) { $this->db = $db; $this->cache = $cache; @@ -117,7 +119,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte { include($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext); } - $auth_admin = new auth_admin(); + $auth_admin = new \auth_admin(); // We have to add a check to see if the !$global (if global, local, and if local, global) permission already exists. If it does, acl_add_option currently has a bug which would break the ACL system, so we are having a work-around here. if ($this->exists($auth_option, !$global)) @@ -290,7 +292,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte if (!$role_id) { - throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $old_role_name); + throw new \phpbb\db\migration\exception('ROLE_NOT_EXIST', $old_role_name); } $sql = 'UPDATE ' . ACL_ROLES_TABLE . " @@ -380,7 +382,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte if (!$role_id) { - throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $name); + throw new \phpbb\db\migration\exception('ROLE_NOT_EXIST', $name); } $sql = 'SELECT auth_option_id, auth_setting @@ -403,7 +405,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte if (!$group_id) { - throw new phpbb_db_migration_exception('GROUP_NOT_EXIST', $name); + throw new \phpbb\db\migration\exception('GROUP_NOT_EXIST', $name); } // If the group has a role set for them we will add the requested permissions to that role. @@ -523,7 +525,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte if (!$role_id) { - throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $name); + throw new \phpbb\db\migration\exception('ROLE_NOT_EXIST', $name); } $sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' @@ -540,7 +542,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte if (!$group_id) { - throw new phpbb_db_migration_exception('GROUP_NOT_EXIST', $name); + throw new \phpbb\db\migration\exception('GROUP_NOT_EXIST', $name); } // If the group has a role set for them we will remove the requested permissions from that role. diff --git a/phpBB/phpbb/db/migration/tool/interface.php b/phpBB/phpbb/db/migration/tool/tool_interface.php index ced53b2023..e7b89d8858 100644 --- a/phpBB/phpbb/db/migration/tool/interface.php +++ b/phpBB/phpbb/db/migration/tool/tool_interface.php @@ -7,12 +7,14 @@ * */ +namespace phpbb\db\migration\tool; + /** * Migration tool interface * * @package db */ -interface phpbb_db_migration_tool_interface +interface tool_interface { /** * Retrieve a short name used for commands in migrations. |