mirror of
https://github.com/Aviortheking/Blog_IMIE.git
synced 2025-04-22 10:52:09 +00:00
push
This commit is contained in:
parent
194ca52738
commit
d8fa7d01bf
@ -75,20 +75,19 @@ class Functions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function deleteDir($dirPath) {
|
public static function deleteDir($dirPath) {
|
||||||
if (! is_dir($dirPath)) {
|
if (is_dir($dirPath)) {
|
||||||
throw new InvalidArgumentException("$dirPath must be a directory");
|
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
|
||||||
}
|
$dirPath .= '/';
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
$files = glob($dirPath . '*', GLOB_MARK);
|
||||||
|
foreach ($files as $file) {
|
||||||
|
if (is_dir($file)) {
|
||||||
|
self::deleteDir($file);
|
||||||
|
} else {
|
||||||
|
unlink($file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rmdir($dirPath);
|
||||||
}
|
}
|
||||||
rmdir($dirPath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user