aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-03-13 17:11:23 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-03-13 17:12:03 +0100
commita3b95839f5cda01a6a24715489f0f02a4267f014 (patch)
treea938411f173bd6106fecb0703666d43acc60b37f /phpBB/phpbb
parent8a61e4b4c0a490125409cd8990a92e0fe6edebdf (diff)
downloadforums-a3b95839f5cda01a6a24715489f0f02a4267f014.tar
forums-a3b95839f5cda01a6a24715489f0f02a4267f014.tar.gz
forums-a3b95839f5cda01a6a24715489f0f02a4267f014.tar.bz2
forums-a3b95839f5cda01a6a24715489f0f02a4267f014.tar.xz
forums-a3b95839f5cda01a6a24715489f0f02a4267f014.zip
[ticket/12268] Extension finder should not crawl through .git/ of extensions
This new filter ignores .svn and .git directories. When searching for php classes and template files of extensions we don't need to look inside these directories. PHPBB3-12268
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/extension/finder.php3
-rw-r--r--phpBB/phpbb/extension/recursive_filter_iterator.php32
2 files changed, 34 insertions, 1 deletions
diff --git a/phpBB/phpbb/extension/finder.php b/phpBB/phpbb/extension/finder.php
index c9c16ae6d5..fd19436c16 100644
--- a/phpBB/phpbb/extension/finder.php
+++ b/phpBB/phpbb/extension/finder.php
@@ -475,7 +475,8 @@ class finder
}
$directory_pattern = '#' . $directory_pattern . '#';
- $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path), \RecursiveIteratorIterator::SELF_FIRST);
+ $iterator = new \phpbb\extension\recursive_filter_iterator(new \RecursiveDirectoryIterator($path));
+ $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $file_info)
{
$filename = $file_info->getFilename();
diff --git a/phpBB/phpbb/extension/recursive_filter_iterator.php b/phpBB/phpbb/extension/recursive_filter_iterator.php
new file mode 100644
index 0000000000..c2515ecbab
--- /dev/null
+++ b/phpBB/phpbb/extension/recursive_filter_iterator.php
@@ -0,0 +1,32 @@
+<?php
+/**
+*
+* @package extension
+* @copyright (c) 2014 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\extension;
+
+/**
+* Class recursive_filter_iterator
+*
+* This Filter ignores .svn and .git directories.
+* When searching for php classes and template files of extensions
+* we don't need to look inside these directories.
+*
+* @package phpbb\extension
+*/
+class recursive_filter_iterator extends \RecursiveFilterIterator
+{
+ public static $ignore_folders = array(
+ '.svn',
+ '.git',
+ );
+
+ public function accept()
+ {
+ return !in_array($this->current()->getFilename(), self::$ignore_folders);
+ }
+}