remove left overs from last installation, check if renaming succeeded

This commit is contained in:
Uwe Steinmann 2019-10-11 16:29:53 +02:00
parent ec9ad49791
commit 459883748e

View File

@ -348,6 +348,10 @@ class SeedDMS_Extension_Mgr {
public function updateExtension($file) { /* {{{ */ public function updateExtension($file) { /* {{{ */
/* unzip the extension in a temporary directory */ /* unzip the extension in a temporary directory */
$newdir = $this->cachedir ."/ext.new"; $newdir = $this->cachedir ."/ext.new";
/* First remove a left over from a previous extension */
if(file_exists($newdir)) {
self::rrmdir($newdir);
}
if(!mkdir($newdir, 0755)) { if(!mkdir($newdir, 0755)) {
$this->errmsgs[] = "Cannot create temp. extension directory"; $this->errmsgs[] = "Cannot create temp. extension directory";
return false; return false;
@ -375,7 +379,10 @@ class SeedDMS_Extension_Mgr {
$this->rrmdir($this->extdir ."/". $extname); $this->rrmdir($this->extdir ."/". $extname);
} }
/* Move the temp. created ext directory to the final location */ /* Move the temp. created ext directory to the final location */
rename($newdir, $this->extdir ."/". $extname); if(!rename($newdir, $this->extdir ."/". $extname)) {
$this->rrmdir($this->extdir ."/". $extname);
return false;
}
return true; return true;
} /* }}} */ } /* }}} */