mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 18:03:39 +01:00
"using lstat in find and check type 'd' directly against mode from lstat for better performance"
This commit is contained in:
parent
287131565f
commit
9e88b1ba9d
@ -510,14 +510,14 @@ class egw_vfs extends vfs_stream_wrapper
|
|||||||
{
|
{
|
||||||
$type = $options['type']; // 'd' or 'f'
|
$type = $options['type']; // 'd' or 'f'
|
||||||
|
|
||||||
if ($type && ($type == 'd') !== (is_dir($path) && !is_link($path)))
|
if (!($stat = self::url_stat($path,STREAM_URL_STAT_LINK)))
|
||||||
{
|
|
||||||
return; // wrong type
|
|
||||||
}
|
|
||||||
if (!($stat = self::url_stat($path,0)))
|
|
||||||
{
|
{
|
||||||
return; // not found, should not happen
|
return; // not found, should not happen
|
||||||
}
|
}
|
||||||
|
if ($type && ($type == 'd') == !($stat['mode'] & sqlfs_stream_wrapper::MODE_DIR)) // != is_dir() which can be true for symlinks
|
||||||
|
{
|
||||||
|
return; // wrong type
|
||||||
|
}
|
||||||
$stat = array_slice($stat,13); // remove numerical indices 0-12
|
$stat = array_slice($stat,13); // remove numerical indices 0-12
|
||||||
$stat['path'] = parse_url($path,PHP_URL_PATH);
|
$stat['path'] = parse_url($path,PHP_URL_PATH);
|
||||||
$stat['name'] = $options['remove'] > 0 ? implode('/',array_slice(explode('/',$stat['path']),$options['remove'])) : self::basename($path);
|
$stat['name'] = $options['remove'] > 0 ? implode('/',array_slice(explode('/',$stat['path']),$options['remove'])) : self::basename($path);
|
||||||
|
Loading…
Reference in New Issue
Block a user