From 3e992604c711b64232075215e2fec734f7084377 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 23 Feb 2017 14:52:36 -0800 Subject: move some functions to more appropriate places --- boot.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 7120632f4..9338bc5b2 100755 --- a/boot.php +++ b/boot.php @@ -1384,6 +1384,24 @@ function os_mkdir($path, $mode = 0777, $recursive = false) { return $result; } + +// recursively delete a directory +function rrmdir($path) { + if(is_dir($path) === true) { + $files = array_diff(scandir($path), array('.', '..')); + foreach($files as $file) { + rrmdir(realpath($path) . '/' . $file); + } + return rmdir($path); + } + elseif(is_file($path) === true) { + return unlink($path); + } + + return false; +} + + /** * @brief Function to check if request was an AJAX (xmlhttprequest) request. * -- cgit v1.2.3