postDelete hook, imagick dependency, rrmdir
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user