mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-13 13:11:31 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
1307bb74cd
|
@ -494,19 +494,6 @@ class SeedDMS_Extension_Mgr {
|
||||||
return $this->configcache[$extname];
|
return $this->configcache[$extname];
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
static protected function rrmdir($dir) { /* {{{ */
|
|
||||||
if (is_dir($dir)) {
|
|
||||||
$objects = scandir($dir);
|
|
||||||
foreach ($objects as $object) {
|
|
||||||
if ($object != "." && $object != "..") {
|
|
||||||
if (filetype($dir."/".$object) == "dir") self::rrmdir($dir."/".$object); else unlink($dir."/".$object);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reset($objects);
|
|
||||||
rmdir($dir);
|
|
||||||
}
|
|
||||||
} /* }}} */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update an extension
|
* Update an extension
|
||||||
*
|
*
|
||||||
|
@ -522,7 +509,7 @@ class SeedDMS_Extension_Mgr {
|
||||||
$newdir = addDirSep($this->cachedir)."ext.new";
|
$newdir = addDirSep($this->cachedir)."ext.new";
|
||||||
/* First remove a left over from a previous extension */
|
/* First remove a left over from a previous extension */
|
||||||
if(file_exists($newdir)) {
|
if(file_exists($newdir)) {
|
||||||
self::rrmdir($newdir);
|
SeedDMS_Utils::rrmdir($newdir);
|
||||||
}
|
}
|
||||||
if(!mkdir($newdir, 0755)) {
|
if(!mkdir($newdir, 0755)) {
|
||||||
$this->errmsgs[] = "Cannot create temp. extension directory";
|
$this->errmsgs[] = "Cannot create temp. extension directory";
|
||||||
|
@ -542,7 +529,7 @@ class SeedDMS_Extension_Mgr {
|
||||||
|
|
||||||
/* Check if extension is complete and fullfills the constraints */
|
/* Check if extension is complete and fullfills the constraints */
|
||||||
if(!self::checkExtensionByDir($newdir)) {
|
if(!self::checkExtensionByDir($newdir)) {
|
||||||
self::rrmdir($newdir);
|
SeedDMS_Utils::rrmdir($newdir);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,11 +540,11 @@ class SeedDMS_Extension_Mgr {
|
||||||
if(!is_dir($this->extdir)) {
|
if(!is_dir($this->extdir)) {
|
||||||
if(!mkdir($this->extdir, 0755)) {
|
if(!mkdir($this->extdir, 0755)) {
|
||||||
$this->errmsgs[] = "Cannot create extension directory";
|
$this->errmsgs[] = "Cannot create extension directory";
|
||||||
self::rrmdir($newdir);
|
SeedDMS_Utils::rrmdir($newdir);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} elseif(is_dir($this->extdir ."/". $extname)) {
|
} elseif(is_dir($this->extdir ."/". $extname)) {
|
||||||
$this->rrmdir($this->extdir ."/". $extname);
|
SeedDMS_Utils::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() may fail if dirs are moved from one device to another.
|
/* rename() may fail if dirs are moved from one device to another.
|
||||||
|
@ -579,7 +566,7 @@ class SeedDMS_Extension_Mgr {
|
||||||
* has been copied.
|
* has been copied.
|
||||||
*/
|
*/
|
||||||
$this->errmsgs[] = "Cannot move temp. extension directory to final destination";
|
$this->errmsgs[] = "Cannot move temp. extension directory to final destination";
|
||||||
$this->rrmdir($this->extdir ."/". $extname);
|
SeedDMS_Utils::rrmdir($this->extdir ."/". $extname);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1256,6 +1256,34 @@ function getMandatoryApprovers($folder, $document, $user) { /* {{{ */
|
||||||
return $approvers;
|
return $approvers;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class with various utility methods
|
||||||
|
*
|
||||||
|
* This class will sooner or later comprise the functions above
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class SeedDMS_Utils { /* {{{ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively remove a directory on disc
|
||||||
|
*
|
||||||
|
* @param string $dir name of directory
|
||||||
|
*/
|
||||||
|
static public function rrmdir($dir) { /* {{{ */
|
||||||
|
if (is_dir($dir)) {
|
||||||
|
$objects = scandir($dir);
|
||||||
|
foreach ($objects as $object) {
|
||||||
|
if ($object != "." && $object != "..") {
|
||||||
|
if (filetype($dir."/".$object) == "dir") self::rrmdir($dir."/".$object); else unlink($dir."/".$object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reset($objects);
|
||||||
|
rmdir($dir);
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for creating encrypted api keys
|
* Class for creating encrypted api keys
|
||||||
*
|
*
|
||||||
|
|
|
@ -239,9 +239,10 @@ if($newfolder) {
|
||||||
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_importfs')));
|
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_importfs')));
|
||||||
else {
|
else {
|
||||||
if(isset($_GET['remove']) && $_GET["remove"]) {
|
if(isset($_GET['remove']) && $_GET["remove"]) {
|
||||||
$cmd = 'rm -rf '.$dirname;
|
SeedDMS_Utils::rrmdir($dirname);
|
||||||
$ret = null;
|
// $cmd = 'rm -rf '.$dirname;
|
||||||
system($cmd, $ret);
|
// $ret = null;
|
||||||
|
// system($cmd, $ret);
|
||||||
}
|
}
|
||||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_importfs', array('docs'=>$doccount, 'folders'=>$foldercount))));
|
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_importfs', array('docs'=>$doccount, 'folders'=>$foldercount))));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user