mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
replace rename() by exec('mv ..')
This commit is contained in:
parent
334639cbb5
commit
b7b92bcc57
|
@ -488,7 +488,7 @@ class SeedDMS_Extension_Mgr {
|
|||
*/
|
||||
public function updateExtension($file) { /* {{{ */
|
||||
/* unzip the extension in a temporary directory */
|
||||
$newdir = $this->cachedir ."/ext.new";
|
||||
$newdir = addDirSep($this->cachedir)."ext.new";
|
||||
/* First remove a left over from a previous extension */
|
||||
if(file_exists($newdir)) {
|
||||
self::rrmdir($newdir);
|
||||
|
@ -529,7 +529,21 @@ class SeedDMS_Extension_Mgr {
|
|||
$this->rrmdir($this->extdir ."/". $extname);
|
||||
}
|
||||
/* Move the temp. created ext directory to the final location */
|
||||
if(!rename($newdir, $this->extdir ."/". $extname)) {
|
||||
/* rename() may fail if dirs are moved from one device to another.
|
||||
* See https://bugs.php.net/bug.php?id=54097
|
||||
*
|
||||
* exec("mv ".escapeshellarg($newdir)." ".escapeshellarg($this->extdir ."/". $extname));
|
||||
*
|
||||
* It's also sufficient to just copy the extracted archive to the final
|
||||
* location and leave the extracted archive in place. The next time an
|
||||
* extension is imported the last extracted archive will be removed.
|
||||
*/
|
||||
// if(!rename($newdir, $this->extdir ."/". $extname)) {
|
||||
if(false === exec('mv '.escapeshellarg($newdir).' '.escapeshellarg($this->extdir."/".$extname))) {
|
||||
/* If copy didn't succeed, then there is probably nothing to delete,
|
||||
* but do it anyway, just to be sure not just parts of the extension
|
||||
* has been copied.
|
||||
*/
|
||||
$this->rrmdir($this->extdir ."/". $extname);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user