aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2013-05-10 13:58:55 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2013-05-10 13:58:55 -0500
commit27b2bbb8ff9efc6e06cfc5077dc939b1f1f7d0e5 (patch)
tree33f36e300b3155a8a071305821e3499dc98e9a2f /phpBB/includes
parent1b34ddb330d1a666185947ec2325732466f9ce4e (diff)
downloadforums-27b2bbb8ff9efc6e06cfc5077dc939b1f1f7d0e5.tar
forums-27b2bbb8ff9efc6e06cfc5077dc939b1f1f7d0e5.tar.gz
forums-27b2bbb8ff9efc6e06cfc5077dc939b1f1f7d0e5.tar.bz2
forums-27b2bbb8ff9efc6e06cfc5077dc939b1f1f7d0e5.tar.xz
forums-27b2bbb8ff9efc6e06cfc5077dc939b1f1f7d0e5.zip
[ticket/11415] Create function in finder find_from_extension
PHPBB3-11415
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/extension/base.php15
-rw-r--r--phpBB/includes/extension/finder.php28
2 files changed, 30 insertions, 13 deletions
diff --git a/phpBB/includes/extension/base.php b/phpBB/includes/extension/base.php
index 2d22658ff1..a6c9bbb5bc 100644
--- a/phpBB/includes/extension/base.php
+++ b/phpBB/includes/extension/base.php
@@ -125,21 +125,10 @@ class phpbb_extension_base implements phpbb_extension_interface
}
// Only have the finder search in this extension path directory
- $extensions = array(
- $this->extension_name => $this->extension_path,
- );
-
$finder = $this->extension_manager->get_finder();
- $migrations = array();
- $file_list = $finder
+ $migrations = $finder
->extension_directory('/migrations')
- ->find_from_paths($extensions);
-
- foreach ($file_list as $file)
- {
- $migrations[$file['named_path']] = $file['ext_name'];
- }
-
+ ->find_from_extension($this->extension_name, $this->extension_path);
$migrations = $finder->get_classes_from_files($migrations);
return $migrations;
diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php
index 766b9e9b63..49bb2a514f 100644
--- a/phpBB/includes/extension/finder.php
+++ b/phpBB/includes/extension/finder.php
@@ -377,6 +377,34 @@ class phpbb_extension_finder
return $files;
}
+
+ /**
+ * Finds all file system entries matching the configured options for one
+ * specific extension
+ *
+ * @param string $extension_name Name of the extension
+ * @param string $extension_path Relative path to the extension root directory
+ * @param bool $cache Whether the result should be cached
+ * @param bool $is_dir Directories will be returned when true, only files
+ * otherwise
+ * @return array An array of paths to found items
+ */
+ public function find_from_extension($extension_name, $extension_path, $cache = true, $is_dir = false)
+ {
+ $extensions = array(
+ $extension_name => $extension_path,
+ );
+
+ $files = array();
+ $file_list = $this->find_from_paths($extensions, $cache, $is_dir);
+
+ foreach ($file_list as $file)
+ {
+ $files[$file['named_path']] = $file['ext_name'];
+ }
+
+ return $files;
+ }
/**
* Finds all file system entries matching the configured options from