X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_configRegistry.inc;h=8f882a58eb469f8276fa745214e7694f4e4320bd;hb=d6c14bd5b34b7721593cd1b97eebff5bfc865922;hp=a362e525eaca36855dd2bfc3464cd976b36a42ed;hpb=2593b8c385c1587447b071e104da562bcc3c5be8;p=gosa.git diff --git a/gosa-core/include/class_configRegistry.inc b/gosa-core/include/class_configRegistry.inc index a362e525e..8f882a58e 100644 --- a/gosa-core/include/class_configRegistry.inc +++ b/gosa-core/include/class_configRegistry.inc @@ -20,6 +20,8 @@ class configRegistry{ public $objectClasses = array(); + public $schemaCheckFinished = FALSE; + function __construct($config) { $this->config = &$config; @@ -45,13 +47,16 @@ class configRegistry{ } - function validateSchemata($disableIncompatiblePlugins = FALSE,$displayMessage = FALSE) + function validateSchemata($force = FALSE, $disableIncompatiblePlugins = FALSE,$displayMessage = FALSE) { // We can check the schemata only with a valid LDAP connection if(empty($this->config->current['CONFIG'])){ return(TRUE); } + // Don't do things twice unless forced + if($this->schemaCheckFinished && !$force) return; + // Read objectClasses from ldap if(!count($this->objectClasses)){ $ldap = $this->config->get_ldap_link(); @@ -69,28 +74,35 @@ class configRegistry{ } // Check schema requirements now + $missing = $invalid = array(); foreach($this->pluginRequirements['ldapSchema'] as $cname => $requirements){ foreach($requirements as $oc => $version){ if(!$this->ocAvailable($oc)){ - if($displayMessage){ - msg_dialog::display(_("Schema validation error"), - sprintf(_("The objectClass '%s' which is required for plugin '%s' is not availabe!"), - bold($oc),bold($cname)), - ERROR_DIALOG); - } + $missing[] = $oc; }elseif(!empty($version)){ - $currentVersion = $this->getObjectClassVersion($oc); if(!empty($currentVersion) && !$this->ocVersionMatch($version, $currentVersion)){ - if($displayMessage){ - msg_dialog::display(_("Schema validation error"), - sprintf(_("The objectClass '%s' which is required for plugin '%s' has version %s but %s is required!"),bold($oc),bold($cname),bold($currentVersion),bold($version)), - ERROR_DIALOG); + if($currentVersion == -1){ + $currentVersion = _("unknown"); } + $invalid[] = sprintf(_("%s has version %s but %s required!"), bold($oc),bold($currentVersion),bold($version)); } } } } + + if($displayMessage && count($missing)){ + msg_dialog::display(_("Schema validation error"), + sprintf(_("The following objectClasses are missing! %s"), msgPool::buildList($missing)), + ERROR_DIALOG); + } + if($displayMessage && count($invalid)){ + msg_dialog::display(_("Schema validation error"), + sprintf(_("The following objectClasses do not match the version requirements! %s"), msgPool::buildList($invalid)), + ERROR_DIALOG); + } + + $this->schemaCheckFinished =TRUE; } function ocVersionMatch($required, $installed)