mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-07 08:05:25 +02:00
Merge remote-tracking branch 'igorw/ticket/10323' into develop
* igorw/ticket/10323: [ticket/10323] slight potential performance improvement [ticket/10323] make finder work with PHP 5.2
This commit is contained in:
commit
4378c0f85b
@ -377,14 +377,20 @@ class phpbb_extension_finder
|
|||||||
}
|
}
|
||||||
$directory_pattern = '#' . $directory_pattern . '#';
|
$directory_pattern = '#' . $directory_pattern . '#';
|
||||||
|
|
||||||
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST);
|
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
|
||||||
foreach ($iterator as $file_info)
|
foreach ($iterator as $file_info)
|
||||||
{
|
{
|
||||||
|
$filename = $file_info->getFilename();
|
||||||
|
if ($filename == '.' || $filename == '..')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($file_info->isDir() == $is_dir)
|
if ($file_info->isDir() == $is_dir)
|
||||||
{
|
{
|
||||||
if ($is_dir)
|
if ($is_dir)
|
||||||
{
|
{
|
||||||
$relative_path = $iterator->getInnerIterator()->getSubPath() . DIRECTORY_SEPARATOR . basename($file_info->getFilename()) . DIRECTORY_SEPARATOR;
|
$relative_path = $iterator->getInnerIterator()->getSubPath() . DIRECTORY_SEPARATOR . basename($filename) . DIRECTORY_SEPARATOR;
|
||||||
if ($relative_path[0] !== DIRECTORY_SEPARATOR)
|
if ($relative_path[0] !== DIRECTORY_SEPARATOR)
|
||||||
{
|
{
|
||||||
$relative_path = DIRECTORY_SEPARATOR . $relative_path;
|
$relative_path = DIRECTORY_SEPARATOR . $relative_path;
|
||||||
@ -394,10 +400,9 @@ class phpbb_extension_finder
|
|||||||
{
|
{
|
||||||
$relative_path = DIRECTORY_SEPARATOR . $iterator->getInnerIterator()->getSubPathname();
|
$relative_path = DIRECTORY_SEPARATOR . $iterator->getInnerIterator()->getSubPathname();
|
||||||
}
|
}
|
||||||
$item_name = $file_info->getFilename();
|
|
||||||
|
|
||||||
if ((!$suffix || substr($relative_path, -strlen($suffix)) === $suffix) &&
|
if ((!$suffix || substr($relative_path, -strlen($suffix)) === $suffix) &&
|
||||||
(!$prefix || substr($item_name, 0, strlen($prefix)) === $prefix) &&
|
(!$prefix || substr($filename, 0, strlen($prefix)) === $prefix) &&
|
||||||
(!$directory || preg_match($directory_pattern, $relative_path)))
|
(!$directory || preg_match($directory_pattern, $relative_path)))
|
||||||
{
|
{
|
||||||
$files[str_replace(DIRECTORY_SEPARATOR, '/', $location . $name . substr($relative_path, 1))] = $ext_name;
|
$files[str_replace(DIRECTORY_SEPARATOR, '/', $location . $name . substr($relative_path, 1))] = $ext_name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user