summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f3853fd)
raw | patch | inline | side by side (parent: f3853fd)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 25 May 2010 13:57:57 +0000 (13:57 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 25 May 2010 13:57:57 +0000 (13:57 +0000) |
-Keep results in an array
-Seperated the code which generates the error message into an extra method.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18693 594d385d-05f5-0310-b6e9-bd551577e9d8
-Seperated the code which generates the error message into an extra method.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18693 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/html/main.php | patch | blob | history | |
gosa-core/include/class_configRegistry.inc | patch | blob | history |
index 83f0a7e3d90255bbdcc12dac55a6bb4e51588473..710b8c34e7cc78a65215ce08db1e493c25578fc1 100644 (file)
--- a/gosa-core/html/main.php
+++ b/gosa-core/html/main.php
$config= session::global_get('config');
$config->check_and_reload();
$config->configRegistry->reload();
-$config->configRegistry->validateSchemata($force=FALSE,$disableIncompatiblePlugins=TRUE,$errorMessages= TRUE);
+if(!$config->configRegistry->validateSchemata($force=FALSE,$disableIncompatiblePlugins=TRUE)){
+ $config->configRegistry->displayErrors();
+}
/* Enable compressed output */
if ($config->get_cfg_value("core","sendCompressedOutput") == "true"){
diff --git a/gosa-core/include/class_configRegistry.inc b/gosa-core/include/class_configRegistry.inc
index 7cdd58c406d3bc5261fb91bfb554d7d7ce9f214c..d64d82872403452da0e4ab53659d982d24d8abd9 100644 (file)
public $objectClasses = array();
+ public $detectedSchemaIssues = array();
+ public $schemaCheckFailed = FALSE;
public $schemaCheckFinished = FALSE;
function __construct($config)
}
- function validateSchemata($force = FALSE, $disableIncompatiblePlugins = FALSE,$displayMessage = FALSE)
+ function validateSchemata($force = FALSE, $disableIncompatiblePlugins = FALSE)
{
// We can check the schemata only with a valid LDAP connection
if(empty($this->config->current['CONFIG'])){
}
// Don't do things twice unless forced
- if($this->schemaCheckFinished && !$force) return;
+ if($this->schemaCheckFinished && !$force) return($this->schemaCheckFailed);
+
+ // Prepare result array
+ $this->detectedSchemaIssues = array();
+ $this->detectedSchemaIssues['missing'] = array();
+ $this->detectedSchemaIssues['versionMismatch'] = array();
// Read objectClasses from ldap
if(!count($this->objectClasses)){
}
}
- // Check schema requirements now
- $missing = $invalid = array();
+ // Check schema requirements now $missing = $invalid = array();
foreach($this->pluginRequirements['ldapSchema'] as $cname => $requirements){
foreach($requirements as $oc => $version){
- if(!$this->ocAvailable($oc)){
- $missing[] = $oc;
+ if(1 || !$this->ocAvailable($oc)){
+ $this->detectedSchemaIssues['missing'][] = $oc;
+ $this->schemaCheckFailed = TRUE;
}elseif(!empty($version)){
$currentVersion = $this->getObjectClassVersion($oc);
if(!empty($currentVersion) && !$this->ocVersionMatch($version, $currentVersion)){
if($currentVersion == -1){
$currentVersion = _("unknown");
}
- $invalid[] = sprintf(_("%s has version %s but %s required!"), bold($oc),bold($currentVersion),bold($version));
+ $this->detectedSchemaIssues['versionMismatch'] =
+ sprintf(_("%s has version %s but %s required!"), bold($oc),bold($currentVersion),bold($version));
+ $this->schemaCheckFailed = TRUE;
}
}
}
}
+ $this->schemaCheckFinished =TRUE;
+ return(!$this->schemaCheckFailed);
+ }
- if($displayMessage && count($missing)){
+
+ function displayErrors()
+ {
+ if(count($this->detectedSchemaIssues['missing'])){
msg_dialog::display(_("Schema validation error"),
- _("The following objectClasses are missing:").
- "<div class='scrollContainer' style='height:100px'>".msgPool::buildList($missing)."</div>",
+ _("The following objectClasses are missing:").
+ "<div class='scrollContainer' style='height:100px'>".
+ msgPool::buildList($this->detectedSchemaIssues['missing']).
+ "</div>",
ERROR_DIALOG);
}
- if($displayMessage && count($invalid)){
+ if(count($this->detectedSchemaIssues['versionMismatch'])){
msg_dialog::display(_("Schema validation error"),
- _("The following objectClasses do not match the version requirements:").
- "<div class='scrollContainer' style='height:100px'>".msgPool::buildList($invalid)."</div>",
+ _("The following objectClasses do not match the version requirements:").
+ "<div class='scrollContainer' style='height:100px'>".
+ msgPool::buildList($this->detectedSchemaIssues['versionMismatch']).
+ "</div>",
ERROR_DIALOG);
}
-
- $this->schemaCheckFinished =TRUE;
}
+
function ocVersionMatch($required, $installed)
{
$operator = preg_replace('/^([=<>]*).*$/',"\\1",$required);