mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-16 08:18:53 +00:00
[ticket/12273] Add root path to recursive_event_filter_iterator
PHPBB3-12273
This commit is contained in:
parent
e934cefe80
commit
dbac4bb5c0
2 changed files with 35 additions and 11 deletions
|
@ -112,7 +112,8 @@ class php_exporter
|
|||
new \RecursiveDirectoryIterator(
|
||||
$dir,
|
||||
\FilesystemIterator::SKIP_DOTS
|
||||
)
|
||||
),
|
||||
$dir
|
||||
),
|
||||
\RecursiveIteratorIterator::LEAVES_ONLY
|
||||
);
|
||||
|
|
|
@ -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
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue