diff options
Diffstat (limited to 'ratatoeskr/sys/utils.php')
-rw-r--r-- | ratatoeskr/sys/utils.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ratatoeskr/sys/utils.php b/ratatoeskr/sys/utils.php index 5d0c3dc..d6093ca 100644 --- a/ratatoeskr/sys/utils.php +++ b/ratatoeskr/sys/utils.php @@ -200,6 +200,28 @@ function htmlesc($text) } /* + * Function: delete_directory + * Delete a directory and all of its content. + */ +function delete_directory($dir) +{ + $dir_content = scandir($dir); + foreach($dir_content as $f) + { + if(($f == "..") or ($f == ".")) + continue; + + $f = "$dir/$f"; + + if(is_dir($f)) + delete_directory($f); + else + unlink($f); + } + rmdir($dir); +} + +/* * Constant: SITE_BASE_PATH * The Base path of this ratatoeskr site. */ |