diff options
author | Andreas Gohr <andi@splitbrain.org> | 2014-01-06 21:06:09 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2014-01-06 21:06:09 +0100 |
commit | 0826f6cbd906e92fd040dfd3377f1b2a9db13873 (patch) | |
tree | 6a91248c9fe9d149bc8a159f65b47908d41be846 | |
parent | 9a6e0ba0d07a3ed5d0f4579169b85e0910afe1d0 (diff) | |
download | rpg-0826f6cbd906e92fd040dfd3377f1b2a9db13873.tar.gz rpg-0826f6cbd906e92fd040dfd3377f1b2a9db13873.tar.bz2 |
now use new core funtion to recursively delete
-rw-r--r-- | lib/plugins/extension/helper/extension.php | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php index 02c2cc8ad..f91d237f7 100644 --- a/lib/plugins/extension/helper/extension.php +++ b/lib/plugins/extension/helper/extension.php @@ -33,7 +33,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { */ public function __destruct() { foreach($this->temporary as $dir){ - $this->dir_delete($dir); + io_rmdir($dir, true); } } @@ -640,7 +640,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { */ public function uninstall() { $this->purgeCache(); - return $this->dir_delete($this->getInstallDir()); + return io_rmdir($this->getInstallDir(), true); } /** @@ -769,30 +769,6 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { } /** - * delete, with recursive sub-directory support - * - * @param string $path The path that shall be deleted - * @return bool If the directory has been successfully deleted - */ - protected function dir_delete($path) { - if(!is_string($path) || $path == "") return false; - - if(is_dir($path) && !is_link($path)) { - if(!$dh = @opendir($path)) return false; - - while ($f = readdir($dh)) { - if($f == '..' || $f == '.') continue; - $this->dir_delete("$path/$f"); - } - - closedir($dh); - return @rmdir($path); - } else { - return @unlink($path); - } - } - - /** * Returns a temporary directory * * The directory is registered for cleanup when the class is destroyed @@ -828,7 +804,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { // download if(!$file = io_download($url, $tmp.'/', true, $file, 0)) { - $this->dir_delete($tmp); + io_rmdir($tmp, true); throw new Exception(sprintf($this->getLang('error_download'), '<bdi>'.hsc($url).'</bdi>')); } @@ -926,7 +902,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { } // cleanup - if($tmp) $this->dir_delete($tmp); + if($tmp) io_rmdir($tmp, true); return $installed_extensions; } |