aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2011-01-12 23:02:00 +0100
committerOleg Pudeyev <oleg@bsdpower.com>2011-02-12 22:05:53 -0500
commit9bc62056b27a54cccc4e626350838113a3ba80db (patch)
treed228beac88d51b1f1b8df73a9c0eb274176cef3c
parent165b0ec0b2297ab32ca2c0e4184474720f005e51 (diff)
downloadforums-9bc62056b27a54cccc4e626350838113a3ba80db.tar
forums-9bc62056b27a54cccc4e626350838113a3ba80db.tar.gz
forums-9bc62056b27a54cccc4e626350838113a3ba80db.tar.bz2
forums-9bc62056b27a54cccc4e626350838113a3ba80db.tar.xz
forums-9bc62056b27a54cccc4e626350838113a3ba80db.zip
[feature/system-cron] Add array type hints if appropriate and remove globals.
PHPBB3-9596
-rw-r--r--phpBB/cron.php2
-rw-r--r--phpBB/includes/cron/manager.php33
2 files changed, 23 insertions, 12 deletions
diff --git a/phpBB/cron.php b/phpBB/cron.php
index 80e744d358..cdfd8d0fbe 100644
--- a/phpBB/cron.php
+++ b/phpBB/cron.php
@@ -30,7 +30,7 @@ function output_image()
echo base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
// test without flush ;)
- // flush();
+ flush();
}
function do_cron($cron_lock, $run_tasks)
diff --git a/phpBB/includes/cron/manager.php b/phpBB/includes/cron/manager.php
index 4c7f59092f..d7d161793e 100644
--- a/phpBB/includes/cron/manager.php
+++ b/phpBB/includes/cron/manager.php
@@ -28,17 +28,30 @@ class phpbb_cron_manager
* Set of phpbb_cron_task_wrapper objects.
* Array holding all tasks that have been found.
*
- * @var array
+ * @var array
*/
- private $tasks = array();
+ protected $tasks = array();
+
+ /**
+ * phpBB's root directory.
+ * @var string
+ */
+ protected $phpbb_root_path;
+
+ /**
+ * PHP file extension
+ * @var string
+ */
+ protected $phpEx;
/**
* Constructor. Loads all available tasks.
- *
- * @return void
*/
- public function __construct()
+ public function __construct($phpbb_root_path, $phpEx)
{
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->phpEx = $phpEx;
+
$task_names = $this->find_cron_task_names();
$this->load_tasks($task_names);
}
@@ -59,12 +72,10 @@ class phpbb_cron_manager
*/
public function find_cron_task_names()
{
- global $phpbb_root_path, $phpEx;
-
- $tasks_root_path = $phpbb_root_path . 'includes/cron/task/';
+ $tasks_root_path = $this->phpbb_root_path . 'includes/cron/task/';
$task_names = array();
- $ext = '.' . $phpEx;
+ $ext = '.' . $this->phpEx;
$ext_length = strlen($ext);
$dh = opendir($tasks_root_path);
@@ -115,7 +126,7 @@ class phpbb_cron_manager
*
* @return void
*/
- public function load_tasks($task_names)
+ public function load_tasks(array $task_names)
{
foreach ($task_names as $task_name)
{
@@ -196,7 +207,7 @@ class phpbb_cron_manager
*
* @return phpbb_cron_task_wrapper|null
*/
- public function instantiate_task($name, $args)
+ public function instantiate_task($name, array $args)
{
$task = $this->find_task($name);
if ($task)