Skip to content

Commit

Permalink
cot_rmdir() improve
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex300 committed Apr 21, 2016
1 parent 076d820 commit 1312f10
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions system/functions.php
Expand Up @@ -1022,28 +1022,27 @@ function cot_rmdir($dir)
static $cnt = 0;

if (is_dir($dir)) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $f) {
$path = $dir . DIRECTORY_SEPARATOR . $f;
if ($f != "." && $f != "..")
$objects = scandir($dir);
foreach ($objects as $f) {
$path = $dir . DIRECTORY_SEPARATOR . $f;
if ($f != "." && $f != "..")
{
if (filetype($path) == "dir")
{
cot_rmdir($path);
}
else
{
if (filetype($path) == "dir")
{
cot_rmdir($path);
}
else
{
unlink($path);
$cnt++;
}
unlink($path);
$cnt++;
}
}
reset($objects);
rmdir($dir);
$cnt++;
}
reset($objects);
rmdir($dir);
$cnt++;
}

return $cnt;
}

Expand Down

0 comments on commit 1312f10

Please sign in to comment.