mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-18 02:59:27 +00:00
checkExtension() can also check with the configuration array
This commit is contained in:
parent
f386e83f2e
commit
0a3d3ea382
|
@ -174,15 +174,17 @@ class SeedDMS_Extension_Mgr {
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check content of extension directory
|
* Check content of extension directory or configuration of extension
|
||||||
*
|
*
|
||||||
* @param string $dir full path to extension directory or extension name
|
* @param string|array $dir full path to extension directory or extension name
|
||||||
|
* or an array containing the configuration.
|
||||||
* @param boolean $noconstraints set to true if constraints to local seeddms
|
* @param boolean $noconstraints set to true if constraints to local seeddms
|
||||||
* installation shall not be checked.
|
* installation shall not be checked.
|
||||||
*/
|
*/
|
||||||
public function checkExtension($dir, $noconstraints=false) { /* {{{ */
|
public function checkExtension($dir, $options=array()) { /* {{{ */
|
||||||
$this->errmsgs = array();
|
$this->errmsgs = array();
|
||||||
|
|
||||||
|
if(is_string($dir)) {
|
||||||
if(!file_exists($dir)) {
|
if(!file_exists($dir)) {
|
||||||
if(!file_exists($this->extdir.'/'.$dir))
|
if(!file_exists($this->extdir.'/'.$dir))
|
||||||
return false;
|
return false;
|
||||||
|
@ -204,6 +206,14 @@ class SeedDMS_Extension_Mgr {
|
||||||
}
|
}
|
||||||
|
|
||||||
$extconf = $EXT_CONF[$extname];
|
$extconf = $EXT_CONF[$extname];
|
||||||
|
} elseif(is_array($dir)) {
|
||||||
|
$extconf = $dir;
|
||||||
|
/* If just the configuration is passed, then there is no way to check
|
||||||
|
* for existence of files.
|
||||||
|
*/
|
||||||
|
$options['nofiles'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(!isset($extconf['constraints']['depends']['seeddms'])) {
|
if(!isset($extconf['constraints']['depends']['seeddms'])) {
|
||||||
$this->errmsgs[] = "Missing dependency on SeedDMS";
|
$this->errmsgs[] = "Missing dependency on SeedDMS";
|
||||||
}
|
}
|
||||||
|
@ -219,14 +229,17 @@ class SeedDMS_Extension_Mgr {
|
||||||
if(!isset($extconf['author'])) {
|
if(!isset($extconf['author'])) {
|
||||||
$this->errmsgs[] = "Missing author";
|
$this->errmsgs[] = "Missing author";
|
||||||
}
|
}
|
||||||
|
if(!isset($options['nofiles']) || $options['nofiles'] == false) {
|
||||||
if(!empty($extconf['language']['file']) && !file_exists($dir."/".$extconf['language']['file'])) {
|
if(!empty($extconf['language']['file']) && !file_exists($dir."/".$extconf['language']['file'])) {
|
||||||
$this->errmsgs[] = "Missing language file";
|
$this->errmsgs[] = "Missing language file";
|
||||||
}
|
}
|
||||||
if(!empty($extconf['class']['file']) && !file_exists($dir."/".$extconf['class']['file'])) {
|
if(!empty($extconf['class']['file']) && !file_exists($dir."/".$extconf['class']['file'])) {
|
||||||
$this->errmsgs[] = "Missing class file";
|
$this->errmsgs[] = "Missing class file";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!$noconstraints && isset($extconf['constraints']['depends'])) {
|
if(!isset($options['noconstraints']) || $options['noconstraints'] == false) {
|
||||||
|
if(isset($extconf['constraints']['depends'])) {
|
||||||
foreach($extconf['constraints']['depends'] as $dkey=>$dval) {
|
foreach($extconf['constraints']['depends'] as $dkey=>$dval) {
|
||||||
switch($dkey) {
|
switch($dkey) {
|
||||||
case 'seeddms':
|
case 'seeddms':
|
||||||
|
@ -252,6 +265,7 @@ class SeedDMS_Extension_Mgr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($this->errmsgs)
|
if($this->errmsgs)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user