aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2010-12-17 01:15:57 +0100
committerOleg Pudeyev <oleg@bsdpower.com>2011-02-12 22:05:52 -0500
commitf4f8523ca337b790503760e847a197f6343e1dbc (patch)
tree01464c402f83818d03b754f27ca08853a1e8551f
parent134afe36e2c9734ccc6ed6be5a1896c41dc52227 (diff)
downloadforums-f4f8523ca337b790503760e847a197f6343e1dbc.tar
forums-f4f8523ca337b790503760e847a197f6343e1dbc.tar.gz
forums-f4f8523ca337b790503760e847a197f6343e1dbc.tar.bz2
forums-f4f8523ca337b790503760e847a197f6343e1dbc.tar.xz
forums-f4f8523ca337b790503760e847a197f6343e1dbc.zip
[feature/system-cron] Add phpDoc documentation for phpbb_cron_manager class.
PHPBB3-9596
-rw-r--r--phpBB/includes/cron/manager.php44
1 files changed, 38 insertions, 6 deletions
diff --git a/phpBB/includes/cron/manager.php b/phpBB/includes/cron/manager.php
index 8c5df8cecc..f8d795a426 100644
--- a/phpBB/includes/cron/manager.php
+++ b/phpBB/includes/cron/manager.php
@@ -24,8 +24,19 @@ if (!defined('IN_PHPBB'))
*/
class phpbb_cron_manager
{
+ /**
+ * Set of phpbb_cron_task_wrapper objects.
+ * Array holding all tasks that have been found.
+ *
+ * @var array
+ */
private $tasks = array();
+ /**
+ * Constructor. Loads all available tasks.
+ *
+ * @return void
+ */
public function __construct()
{
$task_names = $this->find_cron_task_names();
@@ -43,6 +54,8 @@ class phpbb_cron_manager
* Cron task is expected to be a class named phpbb_cron_task_${mod}_${name}.
*
* Todo: consider caching found task file list in global cache.
+ *
+ * @return array Array of strings
*/
public function find_cron_task_names()
{
@@ -82,13 +95,26 @@ class phpbb_cron_manager
}
/**
- * Checks whether $name is a valid identifier, and therefore part of valid cron task class name.
+ * Checks whether $name is a valid identifier, and
+ * therefore part of valid cron task class name.
+ *
+ * @param string $name Name to check
+ *
+ * @return int
*/
public function is_valid_name($name)
{
return preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $name);
}
+ /**
+ * Loads tasks given by name, wraps them
+ * and puts them into $this->tasks.
+ *
+ * @param array $task_names Array of strings
+ *
+ * @return void
+ */
public function load_tasks($task_names)
{
foreach ($task_names as $task_name)
@@ -102,8 +128,9 @@ class phpbb_cron_manager
/**
* Finds a task that is ready to run.
- *
* If several tasks are ready, any one of them could be returned.
+ *
+ * @return phpbb_cron_task_wrapper|null
*/
public function find_one_ready_task()
{
@@ -119,6 +146,8 @@ class phpbb_cron_manager
/**
* Finds all tasks that are ready to run.
+ *
+ * @return array Array of phpbb_cron_task_wrapper
*/
public function find_all_ready_tasks()
{
@@ -135,8 +164,9 @@ class phpbb_cron_manager
/**
* Finds a task by name.
- *
* Web runner uses this method to resolve names to tasks.
+ *
+ * @return array|null Array of phpbb_cron_task_wrapper
*/
public function find_task($name)
{
@@ -152,10 +182,12 @@ class phpbb_cron_manager
/**
* Creates an instance of parametrized cron task $name with args $args.
- *
- * $name is the task name, which is the same as cron task class name.
- * $args will be passed to the task class's constructor.
* The constructed task is wrapped with cron task wrapper before being returned.
+ *
+ * @param string $name The task name, which is the same as cron task class name.
+ * @param array $args Will be passed to the task class's constructor.
+ *
+ * @return phpbb_cron_task_wrapper|null
*/
public function instantiate_task($name, $args)
{