Created
August 14, 2013 13:09
-
-
Save catalint/6230882 to your computer and use it in GitHub Desktop.
nip framework - Nip_File_System/emptyDir bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function emptyDir($dir) { | |
$this->denyDelete(); | |
$dir = rtrim($dir, "/"); | |
$files = scandir($dir); | |
array_shift($files); | |
array_shift($files); | |
foreach ($files as $file) { | |
$file = $dir . '/' . $file; | |
if (is_dir($file)) { | |
$this->removeDir($file); | |
} else { | |
unlink($file); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Folderele "." si ".." nu sunt intotdeauna primele (ex. fisier care incepe cu "-")
asadar
prone to bug , sa se duca in directorul superior si sa stearga fisiere care nu vroiam sa stearga
varianta ok: