improved xml cleanup error handling

This commit is contained in:
following
2013-04-10 16:39:41 +02:00
parent dce6a8adce
commit edcc1fb238

View File

@ -1085,28 +1085,33 @@ function unlinkrecursiv($path)
$notunlinked = 0;
$hDir = opendir($path);
while (false !== ($file = readdir($hDir)))
if ($hDir === FALSE)
++$notunlinked;
else
{
if (($file != '.') && ($file != '..'))
while (false !== ($file = readdir($hDir)))
{
if (is_dir($path . $file))
if (($file != '.') && ($file != '..'))
{
if (unlinkrecursiv($path . $file . '/') == false)
$notunlinked++;
}
else
{
if ((mb_substr($file, -4) == '.zip') ||
(mb_substr($file, -3) == '.gz') ||
(mb_substr($file, -4) == '.bz2') ||
(mb_substr($file, -4) == '.xml'))
unlink($path . $file);
if (is_dir($path . $file))
{
if (unlinkrecursiv($path . $file . '/') == false)
$notunlinked++;
}
else
$notunlinked++;
{
if ((mb_substr($file, -4) == '.zip') ||
(mb_substr($file, -3) == '.gz') ||
(mb_substr($file, -4) == '.bz2') ||
(mb_substr($file, -4) == '.xml'))
unlink($path . $file);
else
$notunlinked++;
}
}
}
closedir($hDir);
}
closedir($hDir);
if ($notunlinked == 0)
{