mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[feature/system-cron] make parameterized interface autoloadable
also extract it to a separate file PHPBB3-9596
This commit is contained in:
parent
a9e0f9947d
commit
bd58fa49c0
4 changed files with 51 additions and 34 deletions
|
@ -46,35 +46,3 @@ interface phpbb_cron_task
|
|||
*/
|
||||
public function is_shutdown_function_safe();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parametrized cron task interface.
|
||||
*
|
||||
* Parametrized cron tasks are somewhat of a cross between regular cron tasks and
|
||||
* delayed jobs. Whereas regular cron tasks perform some action globally,
|
||||
* parametrized cron tasks perform actions on a particular object (or objects).
|
||||
* Parametrized cron tasks do not make sense and are not usable without
|
||||
* specifying these objects.
|
||||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
interface phpbb_parametrized_cron_task extends cron_task
|
||||
{
|
||||
/**
|
||||
* Returns parameters of this cron task as an array.
|
||||
*
|
||||
* The array must map string keys to string values.
|
||||
*/
|
||||
public function get_parameters();
|
||||
|
||||
/**
|
||||
* Parses parameters found in $params, which is an array.
|
||||
*
|
||||
* $params contains user input and must not be trusted.
|
||||
* In normal operation $params contains the same data that was returned by
|
||||
* get_parameters method. However, a malicious user can supply arbitrary
|
||||
* data in $params.
|
||||
* Cron task must validate all keys and values in $params before using them.
|
||||
*/
|
||||
public function parse_parameters($params);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ if (!defined('IN_PHPBB'))
|
|||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements phpbb_parametrized_cron_task
|
||||
class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements phpbb_cron_task_parametrized
|
||||
{
|
||||
private $forum_data;
|
||||
|
||||
|
|
49
phpBB/includes/cron/task_parametrized.php
Normal file
49
phpBB/includes/cron/task_parametrized.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @version $Id$
|
||||
* @copyright (c) 2010 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parametrized cron task interface.
|
||||
*
|
||||
* Parametrized cron tasks are somewhat of a cross between regular cron tasks and
|
||||
* delayed jobs. Whereas regular cron tasks perform some action globally,
|
||||
* parametrized cron tasks perform actions on a particular object (or objects).
|
||||
* Parametrized cron tasks do not make sense and are not usable without
|
||||
* specifying these objects.
|
||||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
interface phpbb_cron_task_parametrized extends cron_task
|
||||
{
|
||||
/**
|
||||
* Returns parameters of this cron task as an array.
|
||||
*
|
||||
* The array must map string keys to string values.
|
||||
*/
|
||||
public function get_parameters();
|
||||
|
||||
/**
|
||||
* Parses parameters found in $params, which is an array.
|
||||
*
|
||||
* $params contains user input and must not be trusted.
|
||||
* In normal operation $params contains the same data that was returned by
|
||||
* get_parameters method. However, a malicious user can supply arbitrary
|
||||
* data in $params.
|
||||
* Cron task must validate all keys and values in $params before using them.
|
||||
*/
|
||||
public function parse_parameters($params);
|
||||
}
|
|
@ -40,7 +40,7 @@ class phpbb_cron_task_wrapper
|
|||
*/
|
||||
public function is_parametrized()
|
||||
{
|
||||
return $this->task instanceof phpbb_parametrized_cron_task;
|
||||
return $this->task instanceof phpbb_cron_task_parametrized;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue