always use regular links stream wrapper here: extended one is unnecessary (slow) for just listing attachments

This commit is contained in:
Ralf Becker 2010-10-12 08:17:10 +00:00
parent 0dd58b36cf
commit 2a801e61fe
2 changed files with 9 additions and 6 deletions

View File

@ -1035,13 +1035,16 @@ class egw_link extends solink
*/
static function list_attached($app,$id)
{
$path = self::vfs_path($app,$id,'',true);
$path = self::vfs_path($app,$id);
//error_log(__METHOD__."($app,$id) url=$url");
if (!($extra = self::get_registry($app,'find_extra'))) $extra = array();
// always use regular links stream wrapper here: extended one is unnecessary (slow) for just listing attachments
if (substr($path,0,13) == 'stylite.links') $path = substr($path,8);
$attached = array();
if (($url2stats = egw_vfs::find($path,array('need_mime'=>true,'type'=>'F')+$extra,true)))
if (($url2stats = egw_vfs::find($path,array('need_mime'=>true,'type'=>'F','url'=>true)+$extra,true)))
{
$props = egw_vfs::propfind(array_keys($url2stats)); // get the comments
foreach($url2stats as $url => &$fileinfo)
@ -1059,7 +1062,6 @@ class egw_link extends solink
}
}
$attached[$link['link_id']] = $link;
$urls[] = $url;
}
}
return $attached;

View File

@ -276,9 +276,10 @@ class egw_vfs extends vfs_stream_wrapper
*
* @param string $url=null url of the filesystem to mount, eg. oldvfs://default/
* @param string $path=null path to mount the filesystem in the vfs, eg. /
* @param boolean $check_url = true check if url is an existing directory, before mounting it
* @return array/boolean array with fstab, if called without parameter or true on successful mount
*/
static function mount($url=null,$path=null)
static function mount($url=null,$path=null,$check_url=true)
{
if (!isset($GLOBALS['egw_info']['server']['vfs_fstab'])) // happens eg. in setup
{
@ -306,7 +307,7 @@ class egw_vfs extends vfs_stream_wrapper
}
self::load_wrapper(parse_url($url,PHP_URL_SCHEME));
if (!file_exists($url) || opendir($url) === false)
if ($check_url && (!file_exists($url) || opendir($url) === false))
{
if (self::LOG_LEVEL > 0) error_log(__METHOD__.'('.array2string($url).','.array2string($path).') url does NOT exist!');
return false; // url does not exist
@ -578,7 +579,7 @@ class egw_vfs extends vfs_stream_wrapper
if ($options['url'])
{
$stat = lstat($path);
$stat = @lstat($path);
}
else
{