From 7b05998eb2ccf778f7031529535f8e451aa45fea Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 8 Apr 2008 03:47:47 +0200 Subject: FS#1360 - Update Plugin Manager to use $conf['tmpdir'] rather than its own. Also remove ap_mkdir(), io_mkdir_p() is a drop in replacement darcs-hash:20080408014747-f07c6-69aee0bb73167fd39d6224c4fde63e56596e2646.gz --- lib/plugins/plugin/admin.php | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'lib/plugins/plugin/admin.php') diff --git a/lib/plugins/plugin/admin.php b/lib/plugins/plugin/admin.php index 5b284f539..a8115dffe 100644 --- a/lib/plugins/plugin/admin.php +++ b/lib/plugins/plugin/admin.php @@ -289,10 +289,8 @@ class ap_manage { } $file = $matches[0]; - $folder = "p".md5($file.date('r')); // tmp folder name - will be empty (should really make sure it doesn't already exist) - $tmp = DOKU_PLUGIN."tmp/$folder"; - if (!ap_mkdir($tmp)) { + if (!($tmp = io_mktmpdir())) { $this->manager->error = $this->lang['error_dircreate']."\n"; return false; } @@ -305,8 +303,8 @@ class ap_manage { $this->manager->error = sprintf($this->lang['error_decompress'],$file)."\n"; } - // search tmp/$folder for the folder(s) that has been created - // move that folder(s) to lib/plugins/ + // search $tmp for the folder(s) that has been created + // move the folder(s) to lib/plugins/ if (!$this->manager->error) { if ($dh = @opendir("$tmp/")) { while (false !== ($f = readdir($dh))) { @@ -335,7 +333,7 @@ class ap_manage { } // cleanup - if ($folder && is_dir(DOKU_PLUGIN."tmp/$folder")) ap_delete(DOKU_PLUGIN."tmp/$folder"); + if ($tmp) ap_delete($tmp); if (!$this->manager->error) { $this->refresh(); @@ -666,14 +664,6 @@ class ap_manage { return false; } - // possibly should use io_MakeFileDir, not sure about using its method of error handling - function ap_mkdir($d) { - global $conf; - - $ok = io_mkdir_p($d); - return $ok; - } - // copy with recursive sub-directory support function ap_copy($src, $dst) { global $conf; @@ -681,7 +671,7 @@ class ap_manage { if (is_dir($src)) { if (!$dh = @opendir($src)) return false; - if ($ok = ap_mkdir($dst)) { + if ($ok = io_mkdir_p($dst)) { while ($ok && (false !== ($f = readdir($dh)))) { if ($f == '..' || $f == '.') continue; $ok = ap_copy("$src/$f", "$dst/$f"); -- cgit v1.2.3