aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/cron/task/task.php
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2011-02-13 15:54:42 +0100
committerIgor Wiedler <igor@wiedler.ch>2011-02-13 15:54:42 +0100
commit04bd2e640e771948671ab6554df8962de980f511 (patch)
treed1e5a226ca875e940d1d98c710051d1911d8b2ad /phpBB/includes/cron/task/task.php
parent8f0e9aee5ce518937b7ed05c2cd602e85e5b0b8a (diff)
parent1fd8d6de7f6bb41505530c83e487a9dc18bd25af (diff)
downloadforums-04bd2e640e771948671ab6554df8962de980f511.tar
forums-04bd2e640e771948671ab6554df8962de980f511.tar.gz
forums-04bd2e640e771948671ab6554df8962de980f511.tar.bz2
forums-04bd2e640e771948671ab6554df8962de980f511.tar.xz
forums-04bd2e640e771948671ab6554df8962de980f511.zip
Merge branch 'feature/system-cron' into develop
* feature/system-cron: (67 commits) [feature/system-cron] More tests for cron manager. [feature/system-cron] Added documentation for cron manager constructor. [feature/system-cron] Remove an unecessary assignment and an unecessary comment [feature/system-cron] Clarify comments about flush() call in cron. [feature/system-cron] preg_match returns int so cast to bool, fix comment [feature/system-cron] Rename lock() to acquire and unlock() to release. [feature/system-cron] Cache cron's task names. [feature/system-cron] Use a RecursiveDirectoryIterator instead of readdir. [feature/system-cron] Add array type hints if appropriate and remove globals. [feature/system-cron] Make use of the new config class in locks. [feature/system-cron] Fix duplicate instantiation of class loader in tests. [feature/system-cron] Abstract the database locking mechanism out of cron. [feature/system-cron] Move tests to phpunit.xml and always load class loader [feature/system-cron] Basic tests for cron manager. [feature/system-cron] Added @param/@return documentation [feature/system-cron] Add phpDoc documentation for everything else. [feature/system-cron] Cast result in cron_manager::is_valid_name() to bool. [feature/system-cron] Add phpDoc documentation for phpbb_cron_manager class. [feature/system-cron] Add phpDoc documentation for phpbb_cron_lock class. [feature/system-cron] Adjust SQL query style to follow coding guidelines. ...
Diffstat (limited to 'phpBB/includes/cron/task/task.php')
-rw-r--r--phpBB/includes/cron/task/task.php64
1 files changed, 64 insertions, 0 deletions
diff --git a/phpBB/includes/cron/task/task.php b/phpBB/includes/cron/task/task.php
new file mode 100644
index 0000000000..58c4a96f8e
--- /dev/null
+++ b/phpBB/includes/cron/task/task.php
@@ -0,0 +1,64 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2010 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* Cron task interface
+* @package phpBB3
+*/
+interface phpbb_cron_task
+{
+ /**
+ * Runs this cron task.
+ *
+ * @return void
+ */
+ public function run();
+
+ /**
+ * Returns whether this cron task can run, given current board configuration.
+ *
+ * For example, a cron task that prunes forums can only run when
+ * forum pruning is enabled.
+ *
+ * @return bool
+ */
+ public function is_runnable();
+
+ /**
+ * Returns whether this cron task should run now, because enough time
+ * has passed since it was last run.
+ *
+ * @return bool
+ */
+ public function should_run();
+
+ /**
+ * Returns whether this cron task can be run in shutdown function.
+ *
+ * By the time shutdown sequence invokes a particular piece of code,
+ * resources that that code requires may already be released.
+ * If so, a particular cron task may be marked shutdown function-
+ * unsafe, and it will be executed in normal program flow.
+ *
+ * Generally speaking cron tasks should start off as shutdown function-
+ * safe, and only be marked shutdown function-unsafe if a problem
+ * is discovered.
+ *
+ * @return bool
+ */
+ public function is_shutdown_function_safe();
+}