1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

[ticket/11700] Move all recent code to namespaces

PHPBB3-11700
This commit is contained in:
Nils Adermann
2013-09-10 14:01:09 +02:00
parent 196e1813cd
commit b95fdacdd3
420 changed files with 2316 additions and 1840 deletions

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cron;
/**
* @ignore
*/
@@ -22,10 +24,10 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
class phpbb_cron_manager
class manager
{
/**
* Set of phpbb_cron_task_wrapper objects.
* Set of \phpbb\cron\task\wrapper objects.
* Array holding all tasks that have been found.
*
* @var array
@@ -52,7 +54,7 @@ class phpbb_cron_manager
* Loads tasks given by name, wraps them
* and puts them into $this->tasks.
*
* @param array|Traversable $tasks Array of instances of phpbb_cron_task
* @param array|Traversable $tasks Array of instances of \phpbb\cron\task\task
*
* @return null
*/
@@ -71,7 +73,7 @@ class phpbb_cron_manager
*
* If no tasks are ready, null is returned.
*
* @return phpbb_cron_task_wrapper|null
* @return \phpbb\cron\task\wrapper|null
*/
public function find_one_ready_task()
{
@@ -88,7 +90,7 @@ class phpbb_cron_manager
/**
* Finds all tasks that are ready to run.
*
* @return array List of tasks which are ready to run (wrapped in phpbb_cron_task_wrapper).
* @return array List of tasks which are ready to run (wrapped in \phpbb\cron\task\wrapper).
*/
public function find_all_ready_tasks()
{
@@ -111,7 +113,7 @@ class phpbb_cron_manager
* Web runner uses this method to resolve names to tasks.
*
* @param string $name Name of the task to look up.
* @return phpbb_cron_task A task corresponding to the given name, or null.
* @return \phpbb\cron\task\task A task corresponding to the given name, or null.
*/
public function find_task($name)
{
@@ -126,13 +128,13 @@ class phpbb_cron_manager
}
/**
* Wraps a task inside an instance of phpbb_cron_task_wrapper.
* Wraps a task inside an instance of \phpbb\cron\task\wrapper.
*
* @param phpbb_cron_task $task The task.
* @return phpbb_cron_task_wrapper The wrapped task.
* @param \phpbb\cron\task\task $task The task.
* @return \phpbb\cron\task\wrapper The wrapped task.
*/
public function wrap_task(phpbb_cron_task $task)
public function wrap_task(\phpbb\cron\task\task $task)
{
return new phpbb_cron_task_wrapper($task, $this->phpbb_root_path, $this->php_ext);
return new \phpbb\cron\task\wrapper($task, $this->phpbb_root_path, $this->php_ext);
}
}

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cron\task;
/**
* @ignore
*/
@@ -26,7 +28,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
abstract class phpbb_cron_task_base implements phpbb_cron_task
abstract class base implements \phpbb\cron\task\task
{
private $name;

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cron\task\core;
/**
* @ignore
*/
@@ -24,7 +26,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base
class prune_all_forums extends \phpbb\cron\task\base
{
protected $phpbb_root_path;
protected $php_ext;
@@ -36,10 +38,10 @@ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base
*
* @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension
* @param phpbb_config $config The config
* @param phpbb_db_driver $db The db connection
* @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver $db The db connection
*/
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, phpbb_db_driver $db)
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver $db)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cron\task\core;
/**
* @ignore
*/
@@ -24,7 +26,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements phpbb_cron_task_parametrized
class prune_forum extends \phpbb\cron\task\base implements \phpbb\cron\task\parametrized
{
protected $phpbb_root_path;
protected $php_ext;
@@ -46,10 +48,10 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p
*
* @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension
* @param phpbb_config $config The config
* @param phpbb_db_driver $db The db connection
* @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver $db The db connection
*/
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, phpbb_db_driver $db)
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver $db)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
@@ -132,15 +134,15 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p
/**
* Parses parameters found in $request, which is an instance of
* phpbb_request_request_interface.
* \phpbb\request\request_interface.
*
* It is expected to have a key f whose value is id of the forum to be pruned.
*
* @param phpbb_request_request_interface $request Request object.
* @param \phpbb\request\request_interface $request Request object.
*
* @return null
*/
public function parse_parameters(phpbb_request_request_interface $request)
public function parse_parameters(\phpbb\request\request_interface $request)
{
$this->forum_data = null;
if ($request->is_set('f'))

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cron\task\core;
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
class phpbb_cron_task_core_queue extends phpbb_cron_task_base
class queue extends \phpbb\cron\task\base
{
protected $phpbb_root_path;
protected $php_ext;
@@ -31,9 +33,9 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base
*
* @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension
* @param phpbb_config $config The config
* @param \phpbb\config\config $config The config
*/
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config)
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
@@ -51,7 +53,7 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base
{
include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext);
}
$queue = new queue();
$queue = new \queue();
$queue->process();
}

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cron\task\core;
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base
class tidy_cache extends \phpbb\cron\task\base
{
protected $config;
protected $cache;
@@ -28,10 +30,10 @@ class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base
/**
* Constructor.
*
* @param phpbb_config $config The config
* @param phpbb_cache_driver_driver_interface $cache The cache driver
* @param \phpbb\config\config $config The config
* @param \phpbb\cache\driver\driver_interface $cache The cache driver
*/
public function __construct(phpbb_config $config, phpbb_cache_driver_driver_interface $cache)
public function __construct(\phpbb\config\config $config, \phpbb\cache\driver\driver_interface $cache)
{
$this->config = $config;
$this->cache = $cache;

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cron\task\core;
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base
class tidy_database extends \phpbb\cron\task\base
{
protected $phpbb_root_path;
protected $php_ext;
@@ -31,9 +33,9 @@ class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base
*
* @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension
* @param phpbb_config $config The config
* @param \phpbb\config\config $config The config
*/
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config)
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cron\task\core;
/**
* @ignore
*/
@@ -22,7 +24,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base
class tidy_search extends \phpbb\cron\task\base
{
protected $phpbb_root_path;
protected $php_ext;
@@ -36,12 +38,12 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base
*
* @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension
* @param phpbb_auth $auth The auth
* @param phpbb_config $config The config
* @param phpbb_db_driver $db The db connection
* @param phpbb_user $user The user
* @param \phpbb\auth\auth $auth The auth
* @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver $db The db connection
* @param \phpbb\user $user The user
*/
public function __construct($phpbb_root_path, $php_ext, phpbb_auth $auth, phpbb_config $config, phpbb_db_driver $db, phpbb_user $user)
public function __construct($phpbb_root_path, $php_ext, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\user $user)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cron\task\core;
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base
class tidy_sessions extends \phpbb\cron\task\base
{
protected $config;
protected $user;
@@ -28,10 +30,10 @@ class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base
/**
* Constructor.
*
* @param phpbb_config $config The config
* @param phpbb_user $user The user
* @param \phpbb\config\config $config The config
* @param \phpbb\user $user The user
*/
public function __construct(phpbb_config $config, phpbb_user $user)
public function __construct(\phpbb\config\config $config, \phpbb\user $user)
{
$this->config = $config;
$this->user = $user;

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cron\task\core;
/**
* @ignore
*/
@@ -22,7 +24,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base
class tidy_warnings extends \phpbb\cron\task\base
{
protected $phpbb_root_path;
protected $php_ext;
@@ -33,9 +35,9 @@ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base
*
* @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension
* @param phpbb_config $config The config
* @param \phpbb\config\config $config The config
*/
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config)
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cron\task;
/**
* @ignore
*/
@@ -26,7 +28,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
interface phpbb_cron_task_parametrized extends phpbb_cron_task
interface parametrized extends \phpbb\cron\task\task
{
/**
* Returns parameters of this cron task as an array.
@@ -39,14 +41,14 @@ interface phpbb_cron_task_parametrized extends phpbb_cron_task
/**
* Parses parameters found in $request, which is an instance of
* phpbb_request_request_interface.
* \phpbb\request\request_interface.
*
* $request contains user input and must not be trusted.
* Cron task must validate all data before using it.
*
* @param phpbb_request_request_interface $request Request object.
* @param \phpbb\request\request_interface $request Request object.
*
* @return null
*/
public function parse_parameters(phpbb_request_request_interface $request);
public function parse_parameters(\phpbb\request\request_interface $request);
}

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cron\task;
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Cron task interface
* @package phpBB3
*/
interface phpbb_cron_task
interface task
{
/**
* Returns the name of the task.

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cron\task;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
class phpbb_cron_task_wrapper
class wrapper
{
protected $task;
protected $phpbb_root_path;
@@ -32,9 +34,9 @@ class phpbb_cron_task_wrapper
*
* Wraps a task $task, which must implement cron_task interface.
*
* @param phpbb_cron_task $task The cron task to wrap.
* @param \phpbb\cron\task\task $task The cron task to wrap.
*/
public function __construct(phpbb_cron_task $task, $phpbb_root_path, $php_ext)
public function __construct(\phpbb\cron\task\task $task, $phpbb_root_path, $php_ext)
{
$this->task = $task;
$this->phpbb_root_path = $phpbb_root_path;
@@ -51,7 +53,7 @@ class phpbb_cron_task_wrapper
*/
public function is_parametrized()
{
return $this->task instanceof phpbb_cron_task_parametrized;
return $this->task instanceof \phpbb\cron\task\parametrized;
}
/**