aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/extension
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2011-08-30 00:06:15 -0400
committerNils Adermann <naderman@naderman.de>2011-09-29 15:42:49 +0200
commit6c6a7d7992460e301615bcc1e13bee92ecc65724 (patch)
tree3f35c1cc2add7aa98d906499b8d2192da96aa264 /phpBB/includes/extension
parent7d16007d6a1c042389039ab9ab59c073ecd7c933 (diff)
downloadforums-6c6a7d7992460e301615bcc1e13bee92ecc65724.tar
forums-6c6a7d7992460e301615bcc1e13bee92ecc65724.tar.gz
forums-6c6a7d7992460e301615bcc1e13bee92ecc65724.tar.bz2
forums-6c6a7d7992460e301615bcc1e13bee92ecc65724.tar.xz
forums-6c6a7d7992460e301615bcc1e13bee92ecc65724.zip
[feature/extension-manager] Extract extension provider functionality from cron
PHPBB3-10323
Diffstat (limited to 'phpBB/includes/extension')
-rw-r--r--phpBB/includes/extension/provider.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/phpBB/includes/extension/provider.php b/phpBB/includes/extension/provider.php
new file mode 100644
index 0000000000..9b5ec56d30
--- /dev/null
+++ b/phpBB/includes/extension/provider.php
@@ -0,0 +1,65 @@
+<?php
+/**
+*
+* @package extension
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* Provides a set of items found in extensions
+*
+* @package extension
+*/
+abstract class phpbb_extension_provider implements IteratorAggregate
+{
+ /**
+ * Array holding all found items
+ * @var array
+ */
+ protected $items = array();
+
+ /**
+ * An extension manager to search for items in extensions
+ * @var phpbb_extension_manager
+ */
+ protected $extension_manager;
+
+ /**
+ * Constructor. Loads all available items.
+ *
+ * @param phpbb_extension_manager $extension_manager phpBB extension manager
+ */
+ public function __construct(phpbb_extension_manager $extension_manager)
+ {
+ $this->extension_manager = $extension_manager;
+
+ $this->items = $this->find();
+ }
+
+ /**
+ * Finds template paths using the extension manager.
+ *
+ * @return array List of task names
+ */
+ abstract function find();
+
+ /**
+ * Retrieve an iterator over all items
+ *
+ * @return ArrayIterator An iterator for the array of template paths
+ */
+ public function getIterator()
+ {
+ return new ArrayIterator($this->items);
+ }
+}