From 0532048292e056d62b7bafa5dda3d53b297bce94 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 15 Apr 2010 03:28:59 -0400 Subject: [feature/system-cron] WIP on reorganizing cron tasks into classes. PHPBB3-9596 --- phpBB/includes/cron_tasks/standard/queue.php | 64 ++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 phpBB/includes/cron_tasks/standard/queue.php (limited to 'phpBB/includes/cron_tasks/standard/queue.php') diff --git a/phpBB/includes/cron_tasks/standard/queue.php b/phpBB/includes/cron_tasks/standard/queue.php new file mode 100644 index 0000000000..6a69799ef4 --- /dev/null +++ b/phpBB/includes/cron_tasks/standard/queue.php @@ -0,0 +1,64 @@ +process(); + } + + /** + * Returns whether this cron task can run, given current board configuration. + */ + public function is_runnable() + { + global $phpbb_root_path, $phpEx; + return file_exists($phpbb_root_path . 'cache/queue.' . $phpEx); + } + + /** + * Returns whether this cron task should run now, because enough time + * has passed since it was last run. + */ + public function should_run() + { + global $config; + return $config['last_queue_run'] < time() - $config['queue_interval_config']; + } + + /** + * Returns whether this cron task can be run in shutdown function. + */ + public function is_shutdown_function_safe() + { + global $config; + return !$config['smtp_delivery']; + } +} -- cgit v1.2.1