[regen_thumb] use common deltree function

This commit is contained in:
Shish 2024-01-09 00:37:02 +00:00
parent 6c2c04c602
commit 14646e2bb9

View file

@ -152,7 +152,7 @@ class RegenThumb extends Extension
$page->flash("Deleted $i thumbnails for ".$_POST["delete_thumb_mime"]." images");
} else {
$dir = "data/thumbs/";
$this->remove_dir_recursively($dir);
deltree($dir);
$page->flash("Deleted all thumbnails");
}
@ -174,22 +174,4 @@ class RegenThumb extends Extension
return $database->get_all($query, $args);
}
public function remove_dir_recursively($dir)
{
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") {
$this->remove_dir_recursively($dir."/".$object);
} else {
unlink($dir."/".$object);
}
}
}
reset($objects);
rmdir($dir);
}
}
}