aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/cron/task
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2011-08-31 17:49:48 -0400
committerNils Adermann <naderman@naderman.de>2011-09-29 16:15:53 +0200
commit520a5f92953d350880355dbe46217d2b41edd2bd (patch)
treed0658eaf062ea332dd9be2a94ef5cb010fb35fd7 /phpBB/includes/cron/task
parent52f5fa796f473e11a101b4da91e455bdc4839daf (diff)
downloadforums-520a5f92953d350880355dbe46217d2b41edd2bd.tar
forums-520a5f92953d350880355dbe46217d2b41edd2bd.tar.gz
forums-520a5f92953d350880355dbe46217d2b41edd2bd.tar.bz2
forums-520a5f92953d350880355dbe46217d2b41edd2bd.tar.xz
forums-520a5f92953d350880355dbe46217d2b41edd2bd.zip
[feature/extension-manager] Refactoring the structure of extension provider
PHPBB3-10323
Diffstat (limited to 'phpBB/includes/cron/task')
-rw-r--r--phpBB/includes/cron/task/provider.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/phpBB/includes/cron/task/provider.php b/phpBB/includes/cron/task/provider.php
new file mode 100644
index 0000000000..3f07bac051
--- /dev/null
+++ b/phpBB/includes/cron/task/provider.php
@@ -0,0 +1,50 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* Provides cron manager with tasks
+*
+* Finds installed cron tasks and makes them available to the cron manager.
+*
+* @package phpBB3
+*/
+class phpbb_cron_task_provider extends phpbb_extension_provider
+{
+ /**
+ * 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.
+ *
+ * @return array List of task names
+ */
+ protected function find()
+ {
+ $finder = $this->extension_manager->get_finder();
+
+ return $finder
+ ->suffix('_task')
+ ->directory('/cron')
+ ->default_path('includes/cron/task/core/')
+ ->default_suffix('')
+ ->default_directory('')
+ ->get_classes();
+ }
+}