From 2e76620c8824da62f97cfdaee8f9b1014159fd7c Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 9 Apr 2012 00:22:55 +0200 Subject: [feature/dic] Rewrite cron system to use DIC PHPBB3-10739 --- phpBB/includes/cron/manager.php | 36 +++--------------- phpBB/includes/cron/task/core/prune_all_forums.php | 25 +++++++----- phpBB/includes/cron/task/core/prune_forum.php | 44 +++++++++------------- phpBB/includes/cron/task/core/queue.php | 18 ++++++--- phpBB/includes/cron/task/core/tidy_cache.php | 17 ++++++--- phpBB/includes/cron/task/core/tidy_database.php | 15 ++++++-- phpBB/includes/cron/task/core/tidy_search.php | 24 +++++++----- phpBB/includes/cron/task/core/tidy_sessions.php | 14 +++++-- phpBB/includes/cron/task/core/tidy_warnings.php | 18 ++++++--- phpBB/includes/cron/task/provider.php | 37 ++++++++++-------- 10 files changed, 130 insertions(+), 118 deletions(-) (limited to 'phpBB/includes/cron') diff --git a/phpBB/includes/cron/manager.php b/phpBB/includes/cron/manager.php index 7a78a1b054..5abbc987dd 100644 --- a/phpBB/includes/cron/manager.php +++ b/phpBB/includes/cron/manager.php @@ -35,26 +35,25 @@ class phpbb_cron_manager /** * Constructor. Loads all available tasks. * - * @param array|Traversable $task_names Provides an iterable set of task names + * @param array|Traversable $tasks Provides an iterable set of task names */ - public function __construct($task_names) + public function __construct($tasks) { - $this->load_tasks($task_names); + $this->load_tasks($tasks); } /** * Loads tasks given by name, wraps them * and puts them into $this->tasks. * - * @param array|Traversable $task_names Array of strings + * @param array|Traversable $tasks Array of instances of phpbb_cron_task * * @return void */ - public function load_tasks($task_names) + public function load_tasks($tasks) { - foreach ($task_names as $task_name) + foreach ($tasks as $task) { - $task = new $task_name(); $wrapper = new phpbb_cron_task_wrapper($task); $this->tasks[] = $wrapper; } @@ -120,27 +119,4 @@ class phpbb_cron_manager } return null; } - - /** - * Creates an instance of parametrized cron task $name with args $args. - * 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, array $args) - { - $task = $this->find_task($name); - if ($task) - { - // task here is actually an instance of cron task wrapper - $class = $task->get_name(); - $task = new $class($args); - // need to wrap the new task too - $task = new phpbb_cron_task_wrapper($task); - } - return $task; - } } diff --git a/phpBB/includes/cron/task/core/prune_all_forums.php b/phpBB/includes/cron/task/core/prune_all_forums.php index 15b93a9ca6..f3a179d81b 100644 --- a/phpBB/includes/cron/task/core/prune_all_forums.php +++ b/phpBB/includes/cron/task/core/prune_all_forums.php @@ -26,6 +26,16 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base { + private $phpbb_root_path, $phpEx, $config, $db; + + public function __construct($phpbb_root_path, $phpEx, phpbb_config $config, dbal $db) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = $phpEx; + $this->config = $config; + $this->db = $db; + } + /** * Runs this cron task. * @@ -33,19 +43,17 @@ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base */ public function run() { - global $phpbb_root_path, $phpEx, $db; - if (!function_exists('auto_prune')) { - include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + include($this->phpbb_root_path . 'includes/functions_admin.' . $this->phpEx); } $sql = 'SELECT forum_id, prune_next, enable_prune, prune_days, prune_viewed, forum_flags, prune_freq FROM ' . FORUMS_TABLE . " - WHERE enable_prune = 1 + WHERE enable_prune = 1 AND prune_next < " . time(); - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) { if ($row['prune_days']) { @@ -57,7 +65,7 @@ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base auto_prune($row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']); } } - $db->sql_freeresult($result); + $this->db->sql_freeresult($result); } /** @@ -69,7 +77,6 @@ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base */ public function is_runnable() { - global $config; - return (bool) $config['use_system_cron']; + return (bool) $this->config['use_system_cron']; } } diff --git a/phpBB/includes/cron/task/core/prune_forum.php b/phpBB/includes/cron/task/core/prune_forum.php index 7686fd4281..1f717904ef 100644 --- a/phpBB/includes/cron/task/core/prune_forum.php +++ b/phpBB/includes/cron/task/core/prune_forum.php @@ -26,31 +26,25 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements phpbb_cron_task_parametrized { + private $phpbb_root_path, $phpEx, $config, $db; private $forum_data; + public function __construct($phpbb_root_path, $phpEx, phpbb_config $config, dbal $db) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = $phpEx; + $this->config = $config; + $this->db = $db; + } + /** - * Constructor. - * - * If $forum_data is given, it is assumed to contain necessary information - * about a single forum that is to be pruned. - * - * If $forum_data is not given, forum id will be retrieved via request_var - * and a database query will be performed to load the necessary information - * about the forum. + * Manually set forum data. * * @param array $forum_data Information about a forum to be pruned. */ - public function __construct($forum_data = null) + public function set_forum_data($forum_data) { - global $db; - if ($forum_data) - { - $this->forum_data = $forum_data; - } - else - { - $this->forum_data = null; - } + $this->forum_data = $forum_data; } /** @@ -60,10 +54,9 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p */ public function run() { - global $phpbb_root_path, $phpEx; if (!function_exists('auto_prune')) { - include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + include($this->phpbb_root_path . 'includes/functions_admin.' . $this->phpEx); } if ($this->forum_data['prune_days']) @@ -90,8 +83,7 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p */ public function is_runnable() { - global $config; - return !$config['use_system_cron'] && $this->forum_data; + return !$this->config['use_system_cron'] && $this->forum_data; } /** @@ -130,8 +122,6 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p */ public function parse_parameters(phpbb_request_interface $request) { - global $db; - $this->forum_data = null; if ($request->is_set('f')) { @@ -140,9 +130,9 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p $sql = 'SELECT forum_id, prune_next, enable_prune, prune_days, prune_viewed, forum_flags, prune_freq FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); if ($row) { diff --git a/phpBB/includes/cron/task/core/queue.php b/phpBB/includes/cron/task/core/queue.php index 1c72eec7c7..70db94f31d 100644 --- a/phpBB/includes/cron/task/core/queue.php +++ b/phpBB/includes/cron/task/core/queue.php @@ -22,6 +22,15 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_queue extends phpbb_cron_task_base { + private $phpbb_root_path, $phpEx, $config; + + public function __construct($phpbb_root_path, $phpEx, phpbb_config $config) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = $phpEx; + $this->config = $config; + } + /** * Runs this cron task. * @@ -29,10 +38,9 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base */ public function run() { - global $phpbb_root_path, $phpEx; if (!class_exists('queue')) { - include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->phpEx); } $queue = new queue(); $queue->process(); @@ -47,8 +55,7 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base */ public function is_runnable() { - global $phpbb_root_path, $phpEx; - return file_exists($phpbb_root_path . 'cache/queue.' . $phpEx); + return file_exists($this->phpbb_root_path . 'cache/queue.' . $this->phpEx); } /** @@ -61,7 +68,6 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base */ public function should_run() { - global $config; - return $config['last_queue_run'] < time() - $config['queue_interval_config']; + return $this->config['last_queue_run'] < time() - $this->config['queue_interval_config']; } } diff --git a/phpBB/includes/cron/task/core/tidy_cache.php b/phpBB/includes/cron/task/core/tidy_cache.php index c9dc0bd9ae..530f25dacb 100644 --- a/phpBB/includes/cron/task/core/tidy_cache.php +++ b/phpBB/includes/cron/task/core/tidy_cache.php @@ -22,6 +22,14 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base { + private $config, $cache; + + public function __construct(phpbb_config $config, phpbb_cache_driver_interface $cache) + { + $this->config = $config; + $this->cache = $cache; + } + /** * Runs this cron task. * @@ -29,8 +37,7 @@ class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base */ public function run() { - global $cache; - $cache->tidy(); + $this->cache->tidy(); } /** @@ -43,8 +50,7 @@ class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base */ public function is_runnable() { - global $cache; - return method_exists($cache, 'tidy'); + return method_exists($this->cache, 'tidy'); } /** @@ -58,7 +64,6 @@ class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base */ public function should_run() { - global $config; - return $config['cache_last_gc'] < time() - $config['cache_gc']; + return $this->config['cache_last_gc'] < time() - $this->config['cache_gc']; } } diff --git a/phpBB/includes/cron/task/core/tidy_database.php b/phpBB/includes/cron/task/core/tidy_database.php index 80a1901b1e..910e27cf20 100644 --- a/phpBB/includes/cron/task/core/tidy_database.php +++ b/phpBB/includes/cron/task/core/tidy_database.php @@ -22,6 +22,15 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base { + private $phpbb_root_path, $phpEx, $config; + + public function __construct($phpbb_root_path, $phpEx, phpbb_config $config) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = $phpEx; + $this->config = $config; + } + /** * Runs this cron task. * @@ -29,10 +38,9 @@ class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base */ public function run() { - global $phpbb_root_path, $phpEx; if (!function_exists('tidy_database')) { - include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + include($this->phpbb_root_path . 'includes/functions_admin.' . $this->phpEx); } tidy_database(); } @@ -48,7 +56,6 @@ class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base */ public function should_run() { - global $config; - return $config['database_last_gc'] < time() - $config['database_gc']; + return $this->config['database_last_gc'] < time() - $this->config['database_gc']; } } diff --git a/phpBB/includes/cron/task/core/tidy_search.php b/phpBB/includes/cron/task/core/tidy_search.php index 8a0b1b690a..1b8a0b8151 100644 --- a/phpBB/includes/cron/task/core/tidy_search.php +++ b/phpBB/includes/cron/task/core/tidy_search.php @@ -24,6 +24,15 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base { + private $phpbb_root_path, $phpEx, $config; + + public function __construct($phpbb_root_path, $phpEx, phpbb_config $config) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = $phpEx; + $this->config = $config; + } + /** * Runs this cron task. * @@ -31,14 +40,12 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base */ public function run() { - global $phpbb_root_path, $phpEx, $config, $error; - // Select the search method - $search_type = basename($config['search_type']); + $search_type = basename($this->config['search_type']); if (!class_exists($search_type)) { - include("{$phpbb_root_path}includes/search/$search_type.$phpEx"); + include($this->phpbb_root_path . "includes/search/$search_type." . $this->phpEx); } // We do some additional checks in the module to ensure it can actually be utilised @@ -62,12 +69,10 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base */ public function is_runnable() { - global $phpbb_root_path, $phpEx, $config; - // Select the search method - $search_type = basename($config['search_type']); + $search_type = basename($this->config['search_type']); - return file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx); + return file_exists($this->phpbb_root_path . 'includes/search/' . $search_type . '.' . $this->phpEx); } /** @@ -81,7 +86,6 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base */ public function should_run() { - global $config; - return $config['search_last_gc'] < time() - $config['search_gc']; + return $this->config['search_last_gc'] < time() - $this->config['search_gc']; } } diff --git a/phpBB/includes/cron/task/core/tidy_sessions.php b/phpBB/includes/cron/task/core/tidy_sessions.php index ae7bb242b8..b409c93868 100644 --- a/phpBB/includes/cron/task/core/tidy_sessions.php +++ b/phpBB/includes/cron/task/core/tidy_sessions.php @@ -22,6 +22,14 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base { + private $config, $user; + + public function __construct(phpbb_config $config, phpbb_user $user) + { + $this->config = $config; + $this->user = $user; + } + /** * Runs this cron task. * @@ -29,8 +37,7 @@ class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base */ public function run() { - global $user; - $user->session_gc(); + $this->user->session_gc(); } /** @@ -44,7 +51,6 @@ class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base */ public function should_run() { - global $config; - return $config['session_last_gc'] < time() - $config['session_gc']; + return $this->config['session_last_gc'] < time() - $this->config['session_gc']; } } diff --git a/phpBB/includes/cron/task/core/tidy_warnings.php b/phpBB/includes/cron/task/core/tidy_warnings.php index e1434e7087..3b87a300d0 100644 --- a/phpBB/includes/cron/task/core/tidy_warnings.php +++ b/phpBB/includes/cron/task/core/tidy_warnings.php @@ -24,6 +24,15 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base { + private $phpbb_root_path, $phpEx, $config; + + public function __construct($phpbb_root_path, $phpEx, phpbb_config $config) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = $phpEx; + $this->config = $config; + } + /** * Runs this cron task. * @@ -31,10 +40,9 @@ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base */ public function run() { - global $phpbb_root_path, $phpEx; if (!function_exists('tidy_warnings')) { - include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + include($this->phpbb_root_path . 'includes/functions_admin.' . $this->phpEx); } tidy_warnings(); } @@ -48,8 +56,7 @@ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base */ public function is_runnable() { - global $config; - return (bool) $config['warnings_expire_days']; + return (bool) $this->config['warnings_expire_days']; } /** @@ -63,7 +70,6 @@ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base */ public function should_run() { - global $config; - return $config['warnings_last_gc'] < time() - $config['warnings_gc']; + return $this->config['warnings_last_gc'] < time() - $this->config['warnings_gc']; } } diff --git a/phpBB/includes/cron/task/provider.php b/phpBB/includes/cron/task/provider.php index 1482051699..acc3d455ec 100644 --- a/phpBB/includes/cron/task/provider.php +++ b/phpBB/includes/cron/task/provider.php @@ -15,6 +15,8 @@ if (!defined('IN_PHPBB')) exit; } +use Symfony\Component\DependencyInjection\Container; + /** * Provides cron manager with tasks * @@ -22,27 +24,30 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_cron_task_provider extends phpbb_extension_provider +class phpbb_cron_task_provider implements IteratorAggregate { + private $container; + + public function __construct(Container $container) + { + $this->container = $container; + } + /** - * Finds cron task names using the extension manager. - * - * All PHP files in includes/cron/task/core/ are considered tasks. Tasks - * in extensions have to be located in a directory called cron or a subdir - * of a directory called cron. The class and filename must end in a _task - * suffix. Additionally all PHP files in includes/cron/task/core/ are - * tasks. + * Retrieve an iterator over all items * - * @return array List of task names + * @return ArrayIterator An iterator for the array of cron tasks */ - protected function find() + public function getIterator() { - $finder = $this->extension_manager->get_finder(); + $definitions = $this->container->findTaggedServiceIds('cron.task'); + + $tasks = array(); + foreach ($definitions as $name => $definition) + { + $tasks[] = $this->container->get($name); + } - return $finder - ->extension_suffix('_task') - ->extension_directory('/cron') - ->core_path('includes/cron/task/core/') - ->get_classes(); + return new ArrayIterator($tasks); } } -- cgit v1.2.1 From 3896ee953fbdb45d0485c0b5dcdfca47409a22ed Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 9 Apr 2012 14:34:35 +0200 Subject: [feature/dic] Give all cron tasks a name, change some manager usage PHPBB3-10739 --- phpBB/includes/cron/manager.php | 15 ++++++++++++--- phpBB/includes/cron/task/base.php | 22 ++++++++++++++++++++++ phpBB/includes/cron/task/provider.php | 7 ++++++- phpBB/includes/cron/task/task.php | 7 +++++++ phpBB/includes/cron/task/wrapper.php | 20 ++++++-------------- 5 files changed, 53 insertions(+), 18 deletions(-) (limited to 'phpBB/includes/cron') diff --git a/phpBB/includes/cron/manager.php b/phpBB/includes/cron/manager.php index 5abbc987dd..5ea909eb2c 100644 --- a/phpBB/includes/cron/manager.php +++ b/phpBB/includes/cron/manager.php @@ -32,13 +32,18 @@ class phpbb_cron_manager */ protected $tasks = array(); + protected $phpbb_root_path, $phpEx; + /** * Constructor. Loads all available tasks. * * @param array|Traversable $tasks Provides an iterable set of task names */ - public function __construct($tasks) + public function __construct($tasks, $phpbb_root_path, $phpEx) { + $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = $phpEx; + $this->load_tasks($tasks); } @@ -54,8 +59,7 @@ class phpbb_cron_manager { foreach ($tasks as $task) { - $wrapper = new phpbb_cron_task_wrapper($task); - $this->tasks[] = $wrapper; + $this->tasks[] = $this->wrap_task($task); } } @@ -119,4 +123,9 @@ class phpbb_cron_manager } return null; } + + public function wrap_task(phpbb_cron_task $task) + { + return new phpbb_cron_task_wrapper($task, $this->phpbb_root_path, $this->phpEx); + } } diff --git a/phpBB/includes/cron/task/base.php b/phpBB/includes/cron/task/base.php index c05fb9a87c..94a2f267b4 100644 --- a/phpBB/includes/cron/task/base.php +++ b/phpBB/includes/cron/task/base.php @@ -28,6 +28,28 @@ if (!defined('IN_PHPBB')) */ abstract class phpbb_cron_task_base implements phpbb_cron_task { + private $name; + + /** + * Returns the name of the task. + * + * @return string Name of wrapped task. + */ + public function get_name() + { + return $this->name; + } + + /** + * Sets the name of the task. + * + * @param string $name The task name + */ + public function set_name($name) + { + $this->name = $name; + } + /** * Returns whether this cron task can run, given current board configuration. * diff --git a/phpBB/includes/cron/task/provider.php b/phpBB/includes/cron/task/provider.php index acc3d455ec..9994d707f2 100644 --- a/phpBB/includes/cron/task/provider.php +++ b/phpBB/includes/cron/task/provider.php @@ -45,7 +45,12 @@ class phpbb_cron_task_provider implements IteratorAggregate $tasks = array(); foreach ($definitions as $name => $definition) { - $tasks[] = $this->container->get($name); + $task = $this->container->get($name); + if ($task instanceof phpbb_cron_task_base) { + $task->set_name($name); + } + + $tasks[] = $task; } return new ArrayIterator($tasks); diff --git a/phpBB/includes/cron/task/task.php b/phpBB/includes/cron/task/task.php index 2f2a9e51f9..7b08fed413 100644 --- a/phpBB/includes/cron/task/task.php +++ b/phpBB/includes/cron/task/task.php @@ -21,6 +21,13 @@ if (!defined('IN_PHPBB')) */ interface phpbb_cron_task { + /** + * Returns the name of the task. + * + * @return string Name of wrapped task. + */ + public function get_name(); + /** * Runs this cron task. * diff --git a/phpBB/includes/cron/task/wrapper.php b/phpBB/includes/cron/task/wrapper.php index 66c45189e5..75b7fbdaa3 100644 --- a/phpBB/includes/cron/task/wrapper.php +++ b/phpBB/includes/cron/task/wrapper.php @@ -23,6 +23,8 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_wrapper { + private $task, $phpbb_root_path, $phpEx; + /** * Constructor. * @@ -30,9 +32,11 @@ class phpbb_cron_task_wrapper * * @param phpbb_cron_task $task The cron task to wrap. */ - public function __construct(phpbb_cron_task $task) + public function __construct(phpbb_cron_task $task, $phpbb_root_path, $phpEx) { $this->task = $task; + $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = $phpEx; } /** @@ -61,16 +65,6 @@ class phpbb_cron_task_wrapper return $this->task->is_runnable() && $this->task->should_run(); } - /** - * Returns the name of wrapped task. It is the same as the wrapped class's class name. - * - * @return string Class name of wrapped task. - */ - public function get_name() - { - return get_class($this->task); - } - /** * Returns a url through which this task may be invoked via web. * @@ -82,8 +76,6 @@ class phpbb_cron_task_wrapper */ public function get_url() { - global $phpbb_root_path, $phpEx; - $name = $this->get_name(); if ($this->is_parametrized()) { @@ -98,7 +90,7 @@ class phpbb_cron_task_wrapper { $extra = ''; } - $url = append_sid($phpbb_root_path . 'cron.' . $phpEx, 'cron_type=' . $name . $extra); + $url = append_sid($this->phpbb_root_path . 'cron.' . $this->phpEx, 'cron_type=' . $name . $extra); return $url; } -- cgit v1.2.1 From 3ebe89cb7eff57c3ffdbe0b7dcd9cdc35b48d26b Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 9 Apr 2012 15:05:28 +0200 Subject: [feature/dic] Fix test suite for dic-powered cron PHPBB3-10739 --- phpBB/includes/cron/task/provider.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/cron') diff --git a/phpBB/includes/cron/task/provider.php b/phpBB/includes/cron/task/provider.php index 9994d707f2..6adac77eb8 100644 --- a/phpBB/includes/cron/task/provider.php +++ b/phpBB/includes/cron/task/provider.php @@ -15,7 +15,7 @@ if (!defined('IN_PHPBB')) exit; } -use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\TaggedContainerInterface; /** * Provides cron manager with tasks @@ -28,7 +28,7 @@ class phpbb_cron_task_provider implements IteratorAggregate { private $container; - public function __construct(Container $container) + public function __construct(TaggedContainerInterface $container) { $this->container = $container; } -- cgit v1.2.1 From 5cdcaaa5318c05a04c544eeb25ced571737c2ce3 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 26 Jul 2012 16:15:56 +0200 Subject: [feature/dic] Rename {phpEx => php_ext} for consistency PHPBB3-10739 --- phpBB/includes/cron/manager.php | 8 ++++---- phpBB/includes/cron/task/core/prune_all_forums.php | 8 ++++---- phpBB/includes/cron/task/core/prune_forum.php | 8 ++++---- phpBB/includes/cron/task/core/queue.php | 10 +++++----- phpBB/includes/cron/task/core/tidy_database.php | 8 ++++---- phpBB/includes/cron/task/core/tidy_search.php | 10 +++++----- phpBB/includes/cron/task/core/tidy_warnings.php | 8 ++++---- phpBB/includes/cron/task/wrapper.php | 8 ++++---- 8 files changed, 34 insertions(+), 34 deletions(-) (limited to 'phpBB/includes/cron') diff --git a/phpBB/includes/cron/manager.php b/phpBB/includes/cron/manager.php index 5ea909eb2c..018ae39f18 100644 --- a/phpBB/includes/cron/manager.php +++ b/phpBB/includes/cron/manager.php @@ -32,17 +32,17 @@ class phpbb_cron_manager */ protected $tasks = array(); - protected $phpbb_root_path, $phpEx; + protected $phpbb_root_path, $php_ext; /** * Constructor. Loads all available tasks. * * @param array|Traversable $tasks Provides an iterable set of task names */ - public function __construct($tasks, $phpbb_root_path, $phpEx) + public function __construct($tasks, $phpbb_root_path, $php_ext) { $this->phpbb_root_path = $phpbb_root_path; - $this->phpEx = $phpEx; + $this->php_ext = $php_ext; $this->load_tasks($tasks); } @@ -126,6 +126,6 @@ class phpbb_cron_manager public function wrap_task(phpbb_cron_task $task) { - return new phpbb_cron_task_wrapper($task, $this->phpbb_root_path, $this->phpEx); + return new phpbb_cron_task_wrapper($task, $this->phpbb_root_path, $this->php_ext); } } diff --git a/phpBB/includes/cron/task/core/prune_all_forums.php b/phpBB/includes/cron/task/core/prune_all_forums.php index f3a179d81b..f175dde650 100644 --- a/phpBB/includes/cron/task/core/prune_all_forums.php +++ b/phpBB/includes/cron/task/core/prune_all_forums.php @@ -26,12 +26,12 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base { - private $phpbb_root_path, $phpEx, $config, $db; + private $phpbb_root_path, $php_ext, $config, $db; - public function __construct($phpbb_root_path, $phpEx, phpbb_config $config, dbal $db) + public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, dbal $db) { $this->phpbb_root_path = $phpbb_root_path; - $this->phpEx = $phpEx; + $this->php_ext = $php_ext; $this->config = $config; $this->db = $db; } @@ -45,7 +45,7 @@ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base { if (!function_exists('auto_prune')) { - include($this->phpbb_root_path . 'includes/functions_admin.' . $this->phpEx); + include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext); } $sql = 'SELECT forum_id, prune_next, enable_prune, prune_days, prune_viewed, forum_flags, prune_freq diff --git a/phpBB/includes/cron/task/core/prune_forum.php b/phpBB/includes/cron/task/core/prune_forum.php index 1f717904ef..d3b14ff68e 100644 --- a/phpBB/includes/cron/task/core/prune_forum.php +++ b/phpBB/includes/cron/task/core/prune_forum.php @@ -26,13 +26,13 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements phpbb_cron_task_parametrized { - private $phpbb_root_path, $phpEx, $config, $db; + private $phpbb_root_path, $php_ext, $config, $db; private $forum_data; - public function __construct($phpbb_root_path, $phpEx, phpbb_config $config, dbal $db) + public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, dbal $db) { $this->phpbb_root_path = $phpbb_root_path; - $this->phpEx = $phpEx; + $this->php_ext = $php_ext; $this->config = $config; $this->db = $db; } @@ -56,7 +56,7 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p { if (!function_exists('auto_prune')) { - include($this->phpbb_root_path . 'includes/functions_admin.' . $this->phpEx); + include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext); } if ($this->forum_data['prune_days']) diff --git a/phpBB/includes/cron/task/core/queue.php b/phpBB/includes/cron/task/core/queue.php index 70db94f31d..1c5cd8c5db 100644 --- a/phpBB/includes/cron/task/core/queue.php +++ b/phpBB/includes/cron/task/core/queue.php @@ -22,12 +22,12 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_queue extends phpbb_cron_task_base { - private $phpbb_root_path, $phpEx, $config; + private $phpbb_root_path, $php_ext, $config; - public function __construct($phpbb_root_path, $phpEx, phpbb_config $config) + public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) { $this->phpbb_root_path = $phpbb_root_path; - $this->phpEx = $phpEx; + $this->php_ext = $php_ext; $this->config = $config; } @@ -40,7 +40,7 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base { if (!class_exists('queue')) { - include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->phpEx); + include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext); } $queue = new queue(); $queue->process(); @@ -55,7 +55,7 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base */ public function is_runnable() { - return file_exists($this->phpbb_root_path . 'cache/queue.' . $this->phpEx); + return file_exists($this->phpbb_root_path . 'cache/queue.' . $this->php_ext); } /** diff --git a/phpBB/includes/cron/task/core/tidy_database.php b/phpBB/includes/cron/task/core/tidy_database.php index 910e27cf20..d0e6c9a253 100644 --- a/phpBB/includes/cron/task/core/tidy_database.php +++ b/phpBB/includes/cron/task/core/tidy_database.php @@ -22,12 +22,12 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base { - private $phpbb_root_path, $phpEx, $config; + private $phpbb_root_path, $php_ext, $config; - public function __construct($phpbb_root_path, $phpEx, phpbb_config $config) + public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) { $this->phpbb_root_path = $phpbb_root_path; - $this->phpEx = $phpEx; + $this->php_ext = $php_ext; $this->config = $config; } @@ -40,7 +40,7 @@ class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base { if (!function_exists('tidy_database')) { - include($this->phpbb_root_path . 'includes/functions_admin.' . $this->phpEx); + include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext); } tidy_database(); } diff --git a/phpBB/includes/cron/task/core/tidy_search.php b/phpBB/includes/cron/task/core/tidy_search.php index 1b8a0b8151..fcd639cfee 100644 --- a/phpBB/includes/cron/task/core/tidy_search.php +++ b/phpBB/includes/cron/task/core/tidy_search.php @@ -24,12 +24,12 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base { - private $phpbb_root_path, $phpEx, $config; + private $phpbb_root_path, $php_ext, $config; - public function __construct($phpbb_root_path, $phpEx, phpbb_config $config) + public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) { $this->phpbb_root_path = $phpbb_root_path; - $this->phpEx = $phpEx; + $this->php_ext = $php_ext; $this->config = $config; } @@ -45,7 +45,7 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base if (!class_exists($search_type)) { - include($this->phpbb_root_path . "includes/search/$search_type." . $this->phpEx); + include($this->phpbb_root_path . "includes/search/$search_type." . $this->php_ext); } // We do some additional checks in the module to ensure it can actually be utilised @@ -72,7 +72,7 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base // Select the search method $search_type = basename($this->config['search_type']); - return file_exists($this->phpbb_root_path . 'includes/search/' . $search_type . '.' . $this->phpEx); + return file_exists($this->phpbb_root_path . 'includes/search/' . $search_type . '.' . $this->php_ext); } /** diff --git a/phpBB/includes/cron/task/core/tidy_warnings.php b/phpBB/includes/cron/task/core/tidy_warnings.php index 3b87a300d0..9d9139b950 100644 --- a/phpBB/includes/cron/task/core/tidy_warnings.php +++ b/phpBB/includes/cron/task/core/tidy_warnings.php @@ -24,12 +24,12 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base { - private $phpbb_root_path, $phpEx, $config; + private $phpbb_root_path, $php_ext, $config; - public function __construct($phpbb_root_path, $phpEx, phpbb_config $config) + public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) { $this->phpbb_root_path = $phpbb_root_path; - $this->phpEx = $phpEx; + $this->php_ext = $php_ext; $this->config = $config; } @@ -42,7 +42,7 @@ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base { if (!function_exists('tidy_warnings')) { - include($this->phpbb_root_path . 'includes/functions_admin.' . $this->phpEx); + include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext); } tidy_warnings(); } diff --git a/phpBB/includes/cron/task/wrapper.php b/phpBB/includes/cron/task/wrapper.php index 75b7fbdaa3..d1ddf20156 100644 --- a/phpBB/includes/cron/task/wrapper.php +++ b/phpBB/includes/cron/task/wrapper.php @@ -23,7 +23,7 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_wrapper { - private $task, $phpbb_root_path, $phpEx; + private $task, $phpbb_root_path, $php_ext; /** * Constructor. @@ -32,11 +32,11 @@ class phpbb_cron_task_wrapper * * @param phpbb_cron_task $task The cron task to wrap. */ - public function __construct(phpbb_cron_task $task, $phpbb_root_path, $phpEx) + public function __construct(phpbb_cron_task $task, $phpbb_root_path, $php_ext) { $this->task = $task; $this->phpbb_root_path = $phpbb_root_path; - $this->phpEx = $phpEx; + $this->php_ext = $php_ext; } /** @@ -90,7 +90,7 @@ class phpbb_cron_task_wrapper { $extra = ''; } - $url = append_sid($this->phpbb_root_path . 'cron.' . $this->phpEx, 'cron_type=' . $name . $extra); + $url = append_sid($this->phpbb_root_path . 'cron.' . $this->php_ext, 'cron_type=' . $name . $extra); return $url; } -- cgit v1.2.1 From 4feb9aa8d7bda303b62acec924008f75042eb757 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 25 Aug 2012 16:43:41 +0200 Subject: [feature/dic] Coding style: Braces PHPBB3-10739 --- phpBB/includes/cron/task/provider.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/cron') diff --git a/phpBB/includes/cron/task/provider.php b/phpBB/includes/cron/task/provider.php index 6adac77eb8..134723ebd1 100644 --- a/phpBB/includes/cron/task/provider.php +++ b/phpBB/includes/cron/task/provider.php @@ -46,7 +46,8 @@ class phpbb_cron_task_provider implements IteratorAggregate foreach ($definitions as $name => $definition) { $task = $this->container->get($name); - if ($task instanceof phpbb_cron_task_base) { + if ($task instanceof phpbb_cron_task_base) + { $task->set_name($name); } -- cgit v1.2.1 From 4f0f63ae8feb8efc70954e64bdca1f81ae98b212 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 25 Aug 2012 16:51:19 +0200 Subject: [feature/dic] Make cron task attributes protected, one per line PHPBB3-10739 --- phpBB/includes/cron/manager.php | 3 ++- phpBB/includes/cron/task/core/prune_all_forums.php | 5 ++++- phpBB/includes/cron/task/core/prune_forum.php | 8 ++++++-- phpBB/includes/cron/task/core/queue.php | 4 +++- phpBB/includes/cron/task/core/tidy_cache.php | 3 ++- phpBB/includes/cron/task/core/tidy_database.php | 4 +++- phpBB/includes/cron/task/core/tidy_search.php | 4 +++- phpBB/includes/cron/task/core/tidy_sessions.php | 3 ++- phpBB/includes/cron/task/core/tidy_warnings.php | 4 +++- phpBB/includes/cron/task/wrapper.php | 4 +++- 10 files changed, 31 insertions(+), 11 deletions(-) (limited to 'phpBB/includes/cron') diff --git a/phpBB/includes/cron/manager.php b/phpBB/includes/cron/manager.php index 018ae39f18..7d2931b502 100644 --- a/phpBB/includes/cron/manager.php +++ b/phpBB/includes/cron/manager.php @@ -32,7 +32,8 @@ class phpbb_cron_manager */ protected $tasks = array(); - protected $phpbb_root_path, $php_ext; + protected $phpbb_root_path; + protected $php_ext; /** * Constructor. Loads all available tasks. diff --git a/phpBB/includes/cron/task/core/prune_all_forums.php b/phpBB/includes/cron/task/core/prune_all_forums.php index f175dde650..5164087b68 100644 --- a/phpBB/includes/cron/task/core/prune_all_forums.php +++ b/phpBB/includes/cron/task/core/prune_all_forums.php @@ -26,7 +26,10 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base { - private $phpbb_root_path, $php_ext, $config, $db; + protected $phpbb_root_path; + protected $php_ext; + protected $config; + protected $db; public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, dbal $db) { diff --git a/phpBB/includes/cron/task/core/prune_forum.php b/phpBB/includes/cron/task/core/prune_forum.php index d3b14ff68e..428224a527 100644 --- a/phpBB/includes/cron/task/core/prune_forum.php +++ b/phpBB/includes/cron/task/core/prune_forum.php @@ -26,8 +26,12 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements phpbb_cron_task_parametrized { - private $phpbb_root_path, $php_ext, $config, $db; - private $forum_data; + protected $phpbb_root_path; + protected $php_ext; + protected $config; + protected $db; + + protected $forum_data; public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, dbal $db) { diff --git a/phpBB/includes/cron/task/core/queue.php b/phpBB/includes/cron/task/core/queue.php index 1c5cd8c5db..c436c9bbad 100644 --- a/phpBB/includes/cron/task/core/queue.php +++ b/phpBB/includes/cron/task/core/queue.php @@ -22,7 +22,9 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_queue extends phpbb_cron_task_base { - private $phpbb_root_path, $php_ext, $config; + protected $phpbb_root_path; + protected $php_ext + protected $config; public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) { diff --git a/phpBB/includes/cron/task/core/tidy_cache.php b/phpBB/includes/cron/task/core/tidy_cache.php index 530f25dacb..0c8e8b25fb 100644 --- a/phpBB/includes/cron/task/core/tidy_cache.php +++ b/phpBB/includes/cron/task/core/tidy_cache.php @@ -22,7 +22,8 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base { - private $config, $cache; + protected $config; + protected $cache; public function __construct(phpbb_config $config, phpbb_cache_driver_interface $cache) { diff --git a/phpBB/includes/cron/task/core/tidy_database.php b/phpBB/includes/cron/task/core/tidy_database.php index d0e6c9a253..4b4679f203 100644 --- a/phpBB/includes/cron/task/core/tidy_database.php +++ b/phpBB/includes/cron/task/core/tidy_database.php @@ -22,7 +22,9 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base { - private $phpbb_root_path, $php_ext, $config; + protected $phpbb_root_path; + protected $php_ext + protected $config; public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) { diff --git a/phpBB/includes/cron/task/core/tidy_search.php b/phpBB/includes/cron/task/core/tidy_search.php index fcd639cfee..a2f1b55763 100644 --- a/phpBB/includes/cron/task/core/tidy_search.php +++ b/phpBB/includes/cron/task/core/tidy_search.php @@ -24,7 +24,9 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base { - private $phpbb_root_path, $php_ext, $config; + protected $phpbb_root_path; + protected $php_ext; + protected $config; public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) { diff --git a/phpBB/includes/cron/task/core/tidy_sessions.php b/phpBB/includes/cron/task/core/tidy_sessions.php index b409c93868..695a537274 100644 --- a/phpBB/includes/cron/task/core/tidy_sessions.php +++ b/phpBB/includes/cron/task/core/tidy_sessions.php @@ -22,7 +22,8 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base { - private $config, $user; + protected $config; + protected $user; public function __construct(phpbb_config $config, phpbb_user $user) { diff --git a/phpBB/includes/cron/task/core/tidy_warnings.php b/phpBB/includes/cron/task/core/tidy_warnings.php index 9d9139b950..acffd12052 100644 --- a/phpBB/includes/cron/task/core/tidy_warnings.php +++ b/phpBB/includes/cron/task/core/tidy_warnings.php @@ -24,7 +24,9 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base { - private $phpbb_root_path, $php_ext, $config; + protected $phpbb_root_path; + protected $php_ext; + protected $config; public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) { diff --git a/phpBB/includes/cron/task/wrapper.php b/phpBB/includes/cron/task/wrapper.php index d1ddf20156..386fb5b383 100644 --- a/phpBB/includes/cron/task/wrapper.php +++ b/phpBB/includes/cron/task/wrapper.php @@ -23,7 +23,9 @@ if (!defined('IN_PHPBB')) */ class phpbb_cron_task_wrapper { - private $task, $phpbb_root_path, $php_ext; + protected $task; + protected $phpbb_root_path; + protected $php_ext; /** * Constructor. -- cgit v1.2.1 From fd9fd71a88fad2b33d75722587dbfc0bd100ae50 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 25 Aug 2012 16:54:30 +0200 Subject: [feature/dic] Add docblock for cron_manager::wrap_task() PHPBB3-10739 --- phpBB/includes/cron/manager.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'phpBB/includes/cron') diff --git a/phpBB/includes/cron/manager.php b/phpBB/includes/cron/manager.php index 7d2931b502..ccaa4f3764 100644 --- a/phpBB/includes/cron/manager.php +++ b/phpBB/includes/cron/manager.php @@ -125,6 +125,12 @@ class phpbb_cron_manager return null; } + /** + * 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. + */ public function wrap_task(phpbb_cron_task $task) { return new phpbb_cron_task_wrapper($task, $this->phpbb_root_path, $this->php_ext); -- cgit v1.2.1 From e103b2f0cc8c8317ce4cb2ca8c4e0e42fca283a2 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 25 Aug 2012 17:04:42 +0200 Subject: [feature/dic] Fix parse errors PHPBB3-10739 --- phpBB/includes/cron/task/core/queue.php | 2 +- phpBB/includes/cron/task/core/tidy_database.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/cron') diff --git a/phpBB/includes/cron/task/core/queue.php b/phpBB/includes/cron/task/core/queue.php index c436c9bbad..3278ce9d76 100644 --- a/phpBB/includes/cron/task/core/queue.php +++ b/phpBB/includes/cron/task/core/queue.php @@ -23,7 +23,7 @@ if (!defined('IN_PHPBB')) class phpbb_cron_task_core_queue extends phpbb_cron_task_base { protected $phpbb_root_path; - protected $php_ext + protected $php_ext; protected $config; public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) diff --git a/phpBB/includes/cron/task/core/tidy_database.php b/phpBB/includes/cron/task/core/tidy_database.php index 4b4679f203..c9f81cbb51 100644 --- a/phpBB/includes/cron/task/core/tidy_database.php +++ b/phpBB/includes/cron/task/core/tidy_database.php @@ -23,7 +23,7 @@ if (!defined('IN_PHPBB')) class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base { protected $phpbb_root_path; - protected $php_ext + protected $php_ext; protected $config; public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) -- cgit v1.2.1 From c6e522afb6060a9294defe31eafc0130ee3aff15 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 25 Aug 2012 17:16:20 +0200 Subject: [feature/dic] Add a doc block for the prune_forum cron task forum_data PHPBB3-10739 --- phpBB/includes/cron/task/core/prune_forum.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'phpBB/includes/cron') diff --git a/phpBB/includes/cron/task/core/prune_forum.php b/phpBB/includes/cron/task/core/prune_forum.php index 428224a527..8bb13ffe36 100644 --- a/phpBB/includes/cron/task/core/prune_forum.php +++ b/phpBB/includes/cron/task/core/prune_forum.php @@ -31,6 +31,14 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p protected $config; protected $db; + /** + * If $forum_data is given, it is assumed to contain necessary information + * about a single forum that is to be pruned. + * + * If $forum_data is not given, forum id will be retrieved via request_var + * and a database query will be performed to load the necessary information + * about the forum. + */ protected $forum_data; public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, dbal $db) -- cgit v1.2.1 From 282a80077d4630ba59043fffe59e8a7ce8619ecb Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 1 Sep 2012 19:17:01 +0200 Subject: [feature/dic] Spaces to tabs, add useless docblocks Fully documents the constructors of the processors and the cron tasks. PHPBB3-10739 --- phpBB/includes/cron/task/core/prune_all_forums.php | 8 ++++++++ phpBB/includes/cron/task/core/prune_forum.php | 8 ++++++++ phpBB/includes/cron/task/core/queue.php | 7 +++++++ phpBB/includes/cron/task/core/tidy_cache.php | 6 ++++++ phpBB/includes/cron/task/core/tidy_database.php | 7 +++++++ phpBB/includes/cron/task/core/tidy_search.php | 10 ++++++++++ phpBB/includes/cron/task/core/tidy_sessions.php | 6 ++++++ phpBB/includes/cron/task/core/tidy_warnings.php | 7 +++++++ 8 files changed, 59 insertions(+) (limited to 'phpBB/includes/cron') diff --git a/phpBB/includes/cron/task/core/prune_all_forums.php b/phpBB/includes/cron/task/core/prune_all_forums.php index 5164087b68..252e16e57d 100644 --- a/phpBB/includes/cron/task/core/prune_all_forums.php +++ b/phpBB/includes/cron/task/core/prune_all_forums.php @@ -31,6 +31,14 @@ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base protected $config; protected $db; + /** + * Constructor. + * + * @param string $phpbb_root_path The root path + * @param string $php_ext The PHP extension + * @param phpbb_config $config The config + * @param dbal $db The db connection + */ public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, dbal $db) { $this->phpbb_root_path = $phpbb_root_path; diff --git a/phpBB/includes/cron/task/core/prune_forum.php b/phpBB/includes/cron/task/core/prune_forum.php index 8bb13ffe36..41d60af921 100644 --- a/phpBB/includes/cron/task/core/prune_forum.php +++ b/phpBB/includes/cron/task/core/prune_forum.php @@ -41,6 +41,14 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p */ protected $forum_data; + /** + * Constructor. + * + * @param string $phpbb_root_path The root path + * @param string $php_ext The PHP extension + * @param phpbb_config $config The config + * @param dbal $db The db connection + */ public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, dbal $db) { $this->phpbb_root_path = $phpbb_root_path; diff --git a/phpBB/includes/cron/task/core/queue.php b/phpBB/includes/cron/task/core/queue.php index 3278ce9d76..c765660906 100644 --- a/phpBB/includes/cron/task/core/queue.php +++ b/phpBB/includes/cron/task/core/queue.php @@ -26,6 +26,13 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base protected $php_ext; protected $config; + /** + * Constructor. + * + * @param string $phpbb_root_path The root path + * @param string $php_ext The PHP extension + * @param phpbb_config $config The config + */ public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) { $this->phpbb_root_path = $phpbb_root_path; diff --git a/phpBB/includes/cron/task/core/tidy_cache.php b/phpBB/includes/cron/task/core/tidy_cache.php index 573243c166..6017eea561 100644 --- a/phpBB/includes/cron/task/core/tidy_cache.php +++ b/phpBB/includes/cron/task/core/tidy_cache.php @@ -25,6 +25,12 @@ class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base protected $config; protected $cache; + /** + * Constructor. + * + * @param phpbb_config $config The config + * @param phpbb_cache_driver_interface $cache The cache driver + */ public function __construct(phpbb_config $config, phpbb_cache_driver_interface $cache) { $this->config = $config; diff --git a/phpBB/includes/cron/task/core/tidy_database.php b/phpBB/includes/cron/task/core/tidy_database.php index c9f81cbb51..1d256f964f 100644 --- a/phpBB/includes/cron/task/core/tidy_database.php +++ b/phpBB/includes/cron/task/core/tidy_database.php @@ -26,6 +26,13 @@ class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base protected $php_ext; protected $config; + /** + * Constructor. + * + * @param string $phpbb_root_path The root path + * @param string $php_ext The PHP extension + * @param phpbb_config $config The config + */ public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) { $this->phpbb_root_path = $phpbb_root_path; diff --git a/phpBB/includes/cron/task/core/tidy_search.php b/phpBB/includes/cron/task/core/tidy_search.php index 00af293b6d..2e5f3d79d5 100644 --- a/phpBB/includes/cron/task/core/tidy_search.php +++ b/phpBB/includes/cron/task/core/tidy_search.php @@ -31,6 +31,16 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base protected $db; protected $user; + /** + * Constructor. + * + * @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 dbal $db The db connection + * @param phpbb_user $user The user + */ public function __construct($phpbb_root_path, $php_ext, phpbb_auth $auth, phpbb_config $config, dbal $db, phpbb_user $user) { $this->phpbb_root_path = $phpbb_root_path; diff --git a/phpBB/includes/cron/task/core/tidy_sessions.php b/phpBB/includes/cron/task/core/tidy_sessions.php index 695a537274..13531aa30b 100644 --- a/phpBB/includes/cron/task/core/tidy_sessions.php +++ b/phpBB/includes/cron/task/core/tidy_sessions.php @@ -25,6 +25,12 @@ class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base protected $config; protected $user; + /** + * Constructor. + * + * @param phpbb_config $config The config + * @param phpbb_user $user The user + */ public function __construct(phpbb_config $config, phpbb_user $user) { $this->config = $config; diff --git a/phpBB/includes/cron/task/core/tidy_warnings.php b/phpBB/includes/cron/task/core/tidy_warnings.php index acffd12052..8dd0674fe5 100644 --- a/phpBB/includes/cron/task/core/tidy_warnings.php +++ b/phpBB/includes/cron/task/core/tidy_warnings.php @@ -28,6 +28,13 @@ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base protected $php_ext; protected $config; + /** + * Constructor. + * + * @param string $phpbb_root_path The root path + * @param string $php_ext The PHP extension + * @param phpbb_config $config The config + */ public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) { $this->phpbb_root_path = $phpbb_root_path; -- cgit v1.2.1