Don't delete parent directories
This commit is contained in:
parent
f6f2b59311
commit
d2120b9b61
1 changed files with 4 additions and 0 deletions
|
@ -9,6 +9,10 @@
|
|||
function delete_directory(string $directoryToDelete)
|
||||
{
|
||||
foreach (scandir($directoryToDelete) as $filename) {
|
||||
if (in_array($filename, array('.', '..'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$filepath = $directoryToDelete . '/' . $filename;
|
||||
|
||||
if (is_file($filepath)) {
|
||||
|
|
Loading…
Reference in a new issue