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,19 +403,39 @@ class filemanager_ui
|
|||||||
{
|
{
|
||||||
case 'delete':
|
case 'delete':
|
||||||
$dirs = $files = $errs = 0;
|
$dirs = $files = $errs = 0;
|
||||||
foreach(egw_vfs::find($selected,array('depth'=>true)) as $path)
|
// 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 (($is_dir = egw_vfs::is_dir($path) && !egw_vfs::is_link($path)) && egw_vfs::rmdir($path,0))
|
if (!egw_vfs::is_dir($path) || egw_vfs::is_link($path))
|
||||||
{
|
{
|
||||||
++$dirs;
|
if (egw_vfs::unlink($path))
|
||||||
|
{
|
||||||
|
++$files;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++$errs;
|
||||||
|
}
|
||||||
|
unset($selected[$key]);
|
||||||
}
|
}
|
||||||
elseif (!$is_dir && egw_vfs::unlink($path))
|
}
|
||||||
|
if ($selected) // somethings left to delete
|
||||||
|
{
|
||||||
|
foreach(egw_vfs::find($selected,array('depth'=>true)) as $path)
|
||||||
{
|
{
|
||||||
++$files;
|
if (($is_dir = egw_vfs::is_dir($path) && !egw_vfs::is_link($path)) && egw_vfs::rmdir($path,0))
|
||||||
}
|
{
|
||||||
else
|
++$dirs;
|
||||||
{
|
}
|
||||||
++$errs;
|
elseif (!$is_dir && egw_vfs::unlink($path))
|
||||||
|
{
|
||||||
|
++$files;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++$errs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($errs)
|
if ($errs)
|
||||||
|
Loading…
Reference in New Issue
Block a user