From 2408fbb0c969f9e5e19d980254374974dbfa37b7 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 16 May 2009 08:22:20 +0000 Subject: [PATCH] "implemented dir() and scandir() for egw_vfs" --- phpgwapi/inc/class.egw_vfs.inc.php | 33 +++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/phpgwapi/inc/class.egw_vfs.inc.php b/phpgwapi/inc/class.egw_vfs.inc.php index 73fca9eca9..9cc2a4cd67 100644 --- a/phpgwapi/inc/class.egw_vfs.inc.php +++ b/phpgwapi/inc/class.egw_vfs.inc.php @@ -124,7 +124,7 @@ class egw_vfs extends vfs_stream_wrapper } /** - * opendir working on just the eGW VFS + * opendir working on just the eGW VFS: returns resource for readdir() etc. * * @param string $path filename with absolute path in the eGW VFS * @return resource @@ -138,6 +138,37 @@ class egw_vfs extends vfs_stream_wrapper return opendir(self::PREFIX.$path); } + /** + * dir working on just the eGW VFS: returns directory object + * + * @param string $path filename with absolute path in the eGW VFS + * @return Directory + */ + static function dir($path) + { + if ($path[0] != '/') + { + throw new egw_exception_assertion_failed("Directory '$path' is not an absolute path!"); + } + return dir(self::PREFIX.$path); + } + + /** + * scandir working on just the eGW VFS: returns array with filenames as values + * + * @param string $path filename with absolute path in the eGW VFS + * @param int $sorting_order=0 !$sorting_order (default) alphabetical in ascending order, $sorting_order alphabetical in descending order. + * @return array + */ + static function scandir($path,$sorting_order=0) + { + if ($path[0] != '/') + { + throw new egw_exception_assertion_failed("Directory '$path' is not an absolute path!"); + } + return scandir(self::PREFIX.$path,$sorting_order); + } + /** * copy working on just the eGW VFS *