mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-05 04:49:44 +01:00
"fixed filemanger bug: deleting a symlink to an directory, deletes not just the symlink but the whole directory"
This commit is contained in:
parent
1585a36fdf
commit
4cd23bd2e4
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user