mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +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'
|
||||
|
||||
if ($type && ($type == 'd') !== (is_dir($path) && !is_link($path)))
|
||||
{
|
||||
return; // wrong type
|
||||
}
|
||||
if (!($stat = self::url_stat($path,0)))
|
||||
if (!($stat = self::url_stat($path,STREAM_URL_STAT_LINK)))
|
||||
{
|
||||
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['path'] = parse_url($path,PHP_URL_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