From 9e88b1ba9dca97b5ccc9d18489bbd06aef940511 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 2 May 2009 14:15:31 +0000 Subject: [PATCH] "using lstat in find and check type 'd' directly against mode from lstat for better performance" --- phpgwapi/inc/class.egw_vfs.inc.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpgwapi/inc/class.egw_vfs.inc.php b/phpgwapi/inc/class.egw_vfs.inc.php index 7bece1291f..9a16528ad2 100644 --- a/phpgwapi/inc/class.egw_vfs.inc.php +++ b/phpgwapi/inc/class.egw_vfs.inc.php @@ -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);