checking if attachment or attachment dir exists, before trying to delete it, to quieten warning, also improved warning to be precise if file does not exist, is no directory, or permission missing

This commit is contained in:
Ralf Becker 2009-07-18 09:33:30 +00:00
parent 907da227e6
commit 201f498a9c
2 changed files with 7 additions and 5 deletions

View File

@ -825,12 +825,12 @@ class egw_link extends solink
} }
if (self::DEBUG) if (self::DEBUG)
{ {
echo "<p>egw_link::delete_attached('$app','$id','$fname') url=$url</p>\n"; echo '<p>'.__METHOD__."('$app','$id','$fname') url=$url</p>\n";
} }
if (($Ok = egw_vfs::remove($url,true)) && ((int)$app > 0 || $fname)) if (($Ok = !file_exists($url) || egw_vfs::remove($url,true)) && ((int)$app > 0 || $fname))
{ {
// try removing the dir, in case it's empty // try removing the dir, in case it's empty
@rmdir(egw_vfs::dirname($url)); @egw_vfs::rmdir(egw_vfs::dirname($url));
} }
if (!is_null($current_is_root)) if (!is_null($current_is_root))
{ {

View File

@ -681,10 +681,12 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper
!egw_vfs::check_access($parent,egw_vfs::WRITABLE)) !egw_vfs::check_access($parent,egw_vfs::WRITABLE))
{ {
self::_remove_password($url); self::_remove_password($url);
if (self::LOG_LEVEL) error_log(__METHOD__."($url,$options) (type=$type) permission denied!"); $err_msg = __METHOD__."($url,$options) ".(!$stat ? 'not found!' :
($stat['mime'] != self::DIR_MIME_TYPE ? 'not a directory!' : 'permission denied!'));
if (self::LOG_LEVEL) error_log($err_msg);
if (!($options & STREAM_URL_STAT_QUIET)) if (!($options & STREAM_URL_STAT_QUIET))
{ {
trigger_error(__METHOD__."('$url',$options) (type=$type) permission denied!",E_USER_WARNING); trigger_error($err_msg,E_USER_WARNING);
} }
return false; // no permission or file does not exist return false; // no permission or file does not exist
} }