diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-04-27 23:51:06 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-04-27 23:51:06 +0200 |
commit | dbac4bb5c07973a14469169a6bcc2feeb024306b (patch) | |
tree | a4fe301aa43ad5300794494020b45f1af89b51d5 /phpBB/phpbb/event | |
parent | e934cefe809b91b80db509916a0be4b64a3ad2a5 (diff) | |
download | forums-dbac4bb5c07973a14469169a6bcc2feeb024306b.tar forums-dbac4bb5c07973a14469169a6bcc2feeb024306b.tar.gz forums-dbac4bb5c07973a14469169a6bcc2feeb024306b.tar.bz2 forums-dbac4bb5c07973a14469169a6bcc2feeb024306b.tar.xz forums-dbac4bb5c07973a14469169a6bcc2feeb024306b.zip |
[ticket/12273] Add root path to recursive_event_filter_iterator
PHPBB3-12273
Diffstat (limited to 'phpBB/phpbb/event')
-rw-r--r-- | phpBB/phpbb/event/php_exporter.php | 3 | ||||
-rw-r--r-- | phpBB/phpbb/event/recursive_event_filter_iterator.php | 43 |
2 files changed, 35 insertions, 11 deletions
diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php index 8e4a9d399d..e95426244b 100644 --- a/phpBB/phpbb/event/php_exporter.php +++ b/phpBB/phpbb/event/php_exporter.php @@ -112,7 +112,8 @@ class php_exporter new \RecursiveDirectoryIterator( $dir, \FilesystemIterator::SKIP_DOTS - ) + ), + $dir ), \RecursiveIteratorIterator::LEAVES_ONLY ); diff --git a/phpBB/phpbb/event/recursive_event_filter_iterator.php b/phpBB/phpbb/event/recursive_event_filter_iterator.php index c520bdae4a..970c4bbd04 100644 --- a/phpBB/phpbb/event/recursive_event_filter_iterator.php +++ b/phpBB/phpbb/event/recursive_event_filter_iterator.php @@ -20,6 +20,29 @@ namespace phpbb\event; */ class recursive_event_filter_iterator extends \RecursiveFilterIterator { + protected $root_path; + + /** + * Construct + * + * @param \RecursiveIterator $iterator + * @param string $root_path + */ + public function __construct(\RecursiveIterator $iterator, $root_path) + { + $this->root_path = str_replace(DIRECTORY_SEPARATOR, '/', $root_path); + parent::__construct($iterator); + } + + /** + * Return the inner iterator's children contained in a recursive_event_filter_iterator + * + * @return recursive_event_filter_iterator + */ + public function getChildren() { + return new self($this->getInnerIterator()->getChildren(), $this->root_path); + } + /** * {@inheritDoc} */ @@ -30,16 +53,16 @@ class recursive_event_filter_iterator extends \RecursiveFilterIterator return (substr($relative_path, -4) === '.php' || $this->current()->isDir()) && $filename[0] !== '.' - && strpos($relative_path, 'phpBB/cache/') !== 0 - && strpos($relative_path, 'phpBB/develop/') !== 0 - && strpos($relative_path, 'phpBB/ext/') !== 0 - && strpos($relative_path, 'phpBB/files/') !== 0 - && strpos($relative_path, 'phpBB/includes/utf/') !== 0 - && strpos($relative_path, 'phpBB/language/') !== 0 - && strpos($relative_path, 'phpBB/phpbb/db/migration/data/') !== 0 - && strpos($relative_path, 'phpBB/phpbb/event/') !== 0 - && strpos($relative_path, 'phpBB/store/') !== 0 - && strpos($relative_path, 'phpBB/vendor/') !== 0 + && strpos($relative_path, $this->root_path . 'cache/') !== 0 + && strpos($relative_path, $this->root_path . 'develop/') !== 0 + && strpos($relative_path, $this->root_path . 'ext/') !== 0 + && strpos($relative_path, $this->root_path . 'files/') !== 0 + && strpos($relative_path, $this->root_path . 'includes/utf/') !== 0 + && strpos($relative_path, $this->root_path . 'language/') !== 0 + && strpos($relative_path, $this->root_path . 'phpbb/db/migration/data/') !== 0 + && strpos($relative_path, $this->root_path . 'phpbb/event/') !== 0 + && strpos($relative_path, $this->root_path . 'store/') !== 0 + && strpos($relative_path, $this->root_path . 'vendor/') !== 0 ; } } |