1
0

Delete Descriptions when deleting program (+ more)

This commit is contained in:
2014-07-06 15:45:52 +02:00
parent 427b5b1dc4
commit 6a797015cb
7 changed files with 282 additions and 242 deletions

View File

@@ -36,4 +36,22 @@ class MsHelper {
return (substr($haystack, -$length) === $needle);
}
public static function deleteDir($dirPath) {
if (! is_dir($dirPath)) {
throw new InvalidArgumentException("$dirPath must be a directory");
}
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
$dirPath .= '/';
}
$files = glob($dirPath . '*', GLOB_MARK);
foreach ($files as $file) {
if (is_dir($file)) {
self::deleteDir($file);
} else {
unlink($file);
}
}
rmdir($dirPath);
}
}