diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2012-03-30 21:15:31 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2012-03-30 21:15:31 +0200 |
| commit | cdaa5e28290fe0e9e73ca3a0557ee021a7ab404b (patch) | |
| tree | 5cb6ba6f05bb5cafd8735775ddfeda78923f4940 /src/Phorkie/Tools.php | |
| parent | 8fadde4a3b26523b15ff019cafc1b49f9143293f (diff) | |
| download | phorkie-cdaa5e28290fe0e9e73ca3a0557ee021a7ab404b.tar.gz phorkie-cdaa5e28290fe0e9e73ca3a0557ee021a7ab404b.zip | |
paste deletion is possible now
Diffstat (limited to 'src/Phorkie/Tools.php')
| -rw-r--r-- | src/Phorkie/Tools.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Phorkie/Tools.php b/src/Phorkie/Tools.php new file mode 100644 index 0000000..8e67fe2 --- /dev/null +++ b/src/Phorkie/Tools.php @@ -0,0 +1,26 @@ +<?php +namespace Phorkie; + + +class Tools +{ + public static function recursiveDelete($path) + { + if (!is_dir($path) || is_link($path)) { + return unlink($path); + } + foreach (scandir($path) as $file) { + if ($file == '.' || $file == '..') { + continue; + } + $filepath = $path . DIRECTORY_SEPARATOR . $file; + if (!static::recursiveDelete($filepath)) { + return false; + }; + } + return rmdir($path); + } + +} + +?>
\ No newline at end of file |
