postDelete hook, imagick dependency, rrmdir

This commit is contained in:
2023-01-12 20:13:20 +01:00
parent b0e98033b4
commit 83cf7d1a04
4 changed files with 22 additions and 2 deletions

View File

@@ -284,4 +284,21 @@ function parseClass($class): string {
function isClass(string $str): bool {
$path = getClassPath($str);
return is_file($path) && class_exists($str);
}
function rrmdir(string $dir): void {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object !== "." && $object !== "..") {
$path = $dir . DIRECTORY_SEPARATOR . $object;
if (is_dir($path) && !is_link($path)) {
rrmdir($path);
} else {
unlink($path);
}
}
}
rmdir($dir);
}
}