summaryrefslogtreecommitdiff
path: root/lib/lib_rss.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lib_rss.php')
-rw-r--r--lib/lib_rss.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index 8170c7fd9..e466bcb15 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -319,3 +319,29 @@ function check_install_database() {
return $status;
}
+
+/**
+ * Remove a directory recursively.
+ *
+ * From http://php.net/rmdir#110489
+ *
+ * @param $dir the directory to remove
+ */
+function recursive_unlink($dir) {
+ if (!is_dir($dir)) {
+ return true;
+ }
+
+ $files = array_diff(scandir($dir), array('.', '..'));
+ foreach ($files as $filename) {
+ $filename = $dir . '/' . $filename;
+ if (is_dir($filename)) {
+ @chmod($filename, 0777);
+ recursive_unlink($filename);
+ } else {
+ unlink($filename);
+ }
+ }
+
+ return rmdir($dir);
+}