diff options
| author | 2014-12-08 13:36:08 +0100 | |
|---|---|---|
| committer | 2014-12-08 13:36:08 +0100 | |
| commit | 76358846abe2eba95668d66d3847cbdfe3f8bcdc (patch) | |
| tree | be190958f4527725ac2ba18ffe6baa9b433f4b62 /lib | |
| parent | 0543f96a97fa860fdec38d61b117e6b5addf94b6 (diff) | |
Implement extension deletion
See https://github.com/FreshRSS/FreshRSS/issues/252
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/lib_rss.php | 26 |
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); +} |
