"fixed filemanger bug: deleting a symlink to an directory, deletes not just the symlink but the whole directory"

This commit is contained in:
Ralf Becker 2009-05-11 14:43:34 +00:00
parent 1585a36fdf
commit 4cd23bd2e4

View File

@ -403,6 +403,25 @@ class filemanager_ui
{
case 'delete':
$dirs = $files = $errs = 0;
// we first delete all selected links (and files)
// feeding the links to dirs to egw_vfs::find() deletes the content of the dirs, not just the link!
foreach($selected as $key => $path)
{
if (!egw_vfs::is_dir($path) || egw_vfs::is_link($path))
{
if (egw_vfs::unlink($path))
{
++$files;
}
else
{
++$errs;
}
unset($selected[$key]);
}
}
if ($selected) // somethings left to delete
{
foreach(egw_vfs::find($selected,array('depth'=>true)) as $path)
{
if (($is_dir = egw_vfs::is_dir($path) && !egw_vfs::is_link($path)) && egw_vfs::rmdir($path,0))
@ -418,6 +437,7 @@ class filemanager_ui
++$errs;
}
}
}
if ($errs)
{
return lang('%1 errors deleteting (%2 directories and %3 files deleted)!',$errs,$dirs,$files);