mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 19:18:44 +02:00
#663: Fix for emptying a directory which contains broken symbolic links
SVN:trunk[2707]
This commit is contained in:
@@ -471,16 +471,30 @@ class SetupUtils
|
|||||||
throw new Exception("Attempting to delete directory: '$dir'");
|
throw new Exception("Attempting to delete directory: '$dir'");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(glob($dir . '/*') as $file)
|
$aFiles = scandir($dir); // Warning glob('.*') does not seem to return the broken symbolic links, thus leaving a non-empty directory
|
||||||
|
if ($aFiles !== false)
|
||||||
{
|
{
|
||||||
if(is_dir($file))
|
foreach($aFiles as $file)
|
||||||
{
|
{
|
||||||
self::tidydir($file);
|
if (($file != '.') && ($file != '..'))
|
||||||
rmdir($file);
|
{
|
||||||
}
|
if(is_dir($dir.'/'.$file))
|
||||||
else
|
{
|
||||||
{
|
self::tidydir($dir.'/'.$file);
|
||||||
unlink($file);
|
rmdir($dir.'/'.$file);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!unlink($dir.'/'.$file))
|
||||||
|
{
|
||||||
|
SetupPage::log("Warning - FAILED to remove file '$dir/$file'");
|
||||||
|
}
|
||||||
|
else if (file_exists($dir.'/'.$file))
|
||||||
|
{
|
||||||
|
SetupPage::log("Warning - FAILED to remove file '$dir/.$file'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user