diff options
Diffstat (limited to 'phpBB/phpbb/cron/task')
| -rw-r--r-- | phpBB/phpbb/cron/task/base.php | 4 | ||||
| -rw-r--r-- | phpBB/phpbb/cron/task/core/prune_all_forums.php | 10 | ||||
| -rw-r--r-- | phpBB/phpbb/cron/task/core/prune_forum.php | 16 | ||||
| -rw-r--r-- | phpBB/phpbb/cron/task/core/prune_notifications.php | 65 | ||||
| -rw-r--r-- | phpBB/phpbb/cron/task/core/queue.php | 10 | ||||
| -rw-r--r-- | phpBB/phpbb/cron/task/core/tidy_cache.php | 10 | ||||
| -rw-r--r-- | phpBB/phpbb/cron/task/core/tidy_database.php | 8 | ||||
| -rw-r--r-- | phpBB/phpbb/cron/task/core/tidy_search.php | 14 | ||||
| -rw-r--r-- | phpBB/phpbb/cron/task/core/tidy_sessions.php | 10 | ||||
| -rw-r--r-- | phpBB/phpbb/cron/task/core/tidy_warnings.php | 8 | ||||
| -rw-r--r-- | phpBB/phpbb/cron/task/parametrized.php | 10 | ||||
| -rw-r--r-- | phpBB/phpbb/cron/task/task.php | 4 | ||||
| -rw-r--r-- | phpBB/phpbb/cron/task/wrapper.php | 10 | 
13 files changed, 134 insertions, 45 deletions
| diff --git a/phpBB/phpbb/cron/task/base.php b/phpBB/phpbb/cron/task/base.php index 94a2f267b4..f30c9daf1b 100644 --- a/phpBB/phpbb/cron/task/base.php +++ b/phpBB/phpbb/cron/task/base.php @@ -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; diff --git a/phpBB/phpbb/cron/task/core/prune_all_forums.php b/phpBB/phpbb/cron/task/core/prune_all_forums.php index 2c5d38cec0..8e3ef25ce6 100644 --- a/phpBB/phpbb/cron/task/core/prune_all_forums.php +++ b/phpBB/phpbb/cron/task/core/prune_all_forums.php @@ -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; diff --git a/phpBB/phpbb/cron/task/core/prune_forum.php b/phpBB/phpbb/cron/task/core/prune_forum.php index e3c497f072..f14ab7b702 100644 --- a/phpBB/phpbb/cron/task/core/prune_forum.php +++ b/phpBB/phpbb/cron/task/core/prune_forum.php @@ -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_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_interface $request Request object. +	* @param \phpbb\request\request_interface $request Request object.  	*  	* @return null  	*/ -	public function parse_parameters(phpbb_request_interface $request) +	public function parse_parameters(\phpbb\request\request_interface $request)  	{  		$this->forum_data = null;  		if ($request->is_set('f')) diff --git a/phpBB/phpbb/cron/task/core/prune_notifications.php b/phpBB/phpbb/cron/task/core/prune_notifications.php new file mode 100644 index 0000000000..296c0ae64f --- /dev/null +++ b/phpBB/phpbb/cron/task/core/prune_notifications.php @@ -0,0 +1,65 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ +	exit; +} + +/** +* Prune notifications cron task. +* +* @package phpBB3 +*/ +class phpbb_cron_task_core_prune_notifications extends phpbb_cron_task_base +{ +	protected $config; +	protected $notification_manager; + +	/** +	* Constructor. +	* +	* @param phpbb_config $config The config +	* @param phpbb_notification_manager $notification_manager Notification manager +	*/ +	public function __construct(phpbb_config $config, phpbb_notification_manager $notification_manager) +	{ +		$this->config = $config; +		$this->notification_manager = $notification_manager; +	} + +	/** +	* {@inheritdoc} +	*/ +	public function run() +	{ +		// time minus expire days in seconds +		$timestamp = time() - ($this->config['read_notification_expire_days'] * 60 * 60 * 24); +		$this->notification_manager->prune_notifications($timestamp); +	} + +	/** +	* {@inheritdoc} +	*/ +	public function is_runnable() +	{ +		return (bool) $this->config['read_notification_expire_days']; +	} + +	/** +	* {@inheritdoc} +	*/ +	public function should_run() +	{ +		return $this->config['read_notification_last_gc'] < time() - $this->config['read_notification_gc']; +	} +} diff --git a/phpBB/phpbb/cron/task/core/queue.php b/phpBB/phpbb/cron/task/core/queue.php index 732f9c6bea..cb13df86df 100644 --- a/phpBB/phpbb/cron/task/core/queue.php +++ b/phpBB/phpbb/cron/task/core/queue.php @@ -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();  	} diff --git a/phpBB/phpbb/cron/task/core/tidy_cache.php b/phpBB/phpbb/cron/task/core/tidy_cache.php index 16a45dae7c..021d5fd8a3 100644 --- a/phpBB/phpbb/cron/task/core/tidy_cache.php +++ b/phpBB/phpbb/cron/task/core/tidy_cache.php @@ -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_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_interface $cache) +	public function __construct(\phpbb\config\config $config, \phpbb\cache\driver\driver_interface $cache)  	{  		$this->config = $config;  		$this->cache = $cache; diff --git a/phpBB/phpbb/cron/task/core/tidy_database.php b/phpBB/phpbb/cron/task/core/tidy_database.php index b882e7b500..d03cba1d86 100644 --- a/phpBB/phpbb/cron/task/core/tidy_database.php +++ b/phpBB/phpbb/cron/task/core/tidy_database.php @@ -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; diff --git a/phpBB/phpbb/cron/task/core/tidy_search.php b/phpBB/phpbb/cron/task/core/tidy_search.php index a3d5b7dbd2..ebd0d86cbc 100644 --- a/phpBB/phpbb/cron/task/core/tidy_search.php +++ b/phpBB/phpbb/cron/task/core/tidy_search.php @@ -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; diff --git a/phpBB/phpbb/cron/task/core/tidy_sessions.php b/phpBB/phpbb/cron/task/core/tidy_sessions.php index 95f55235c9..5df019ae46 100644 --- a/phpBB/phpbb/cron/task/core/tidy_sessions.php +++ b/phpBB/phpbb/cron/task/core/tidy_sessions.php @@ -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; diff --git a/phpBB/phpbb/cron/task/core/tidy_warnings.php b/phpBB/phpbb/cron/task/core/tidy_warnings.php index 2a7798e56e..1cc0abbe88 100644 --- a/phpBB/phpbb/cron/task/core/tidy_warnings.php +++ b/phpBB/phpbb/cron/task/core/tidy_warnings.php @@ -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; diff --git a/phpBB/phpbb/cron/task/parametrized.php b/phpBB/phpbb/cron/task/parametrized.php index 5f0e46eafc..1d2f449c58 100644 --- a/phpBB/phpbb/cron/task/parametrized.php +++ b/phpBB/phpbb/cron/task/parametrized.php @@ -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_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_interface $request Request object. +	* @param \phpbb\request\request_interface $request Request object.  	*  	* @return null  	*/ -	public function parse_parameters(phpbb_request_interface $request); +	public function parse_parameters(\phpbb\request\request_interface $request);  } diff --git a/phpBB/phpbb/cron/task/task.php b/phpBB/phpbb/cron/task/task.php index 2d585df96d..84218c4fc9 100644 --- a/phpBB/phpbb/cron/task/task.php +++ b/phpBB/phpbb/cron/task/task.php @@ -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. diff --git a/phpBB/phpbb/cron/task/wrapper.php b/phpBB/phpbb/cron/task/wrapper.php index 386fb5b383..aa015966c6 100644 --- a/phpBB/phpbb/cron/task/wrapper.php +++ b/phpBB/phpbb/cron/task/wrapper.php @@ -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;  	}  	/** | 
