mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-20 07:21:30 +02:00
[ticket/11700] Move all recent code to namespaces
PHPBB3-11700
This commit is contained in:
@@ -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_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_tool_int
|
||||
/**
|
||||
* 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;
|
||||
@@ -129,11 +131,11 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_tool_int
|
||||
/**
|
||||
* Module Add
|
||||
*
|
||||
* Add a new module
|
||||
* Add a new \module
|
||||
*
|
||||
* @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_tool_int
|
||||
|
||||
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_tool_int
|
||||
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_tool_int
|
||||
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_tool_int
|
||||
// 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_tool_int
|
||||
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_tool_int
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_tool_int
|
||||
{
|
||||
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);
|
||||
|
Reference in New Issue
Block a user