From: hickert Date: Tue, 25 May 2010 14:09:07 +0000 (+0000) Subject: Updated config registry X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9cfc11b75a529144a95af464c1af85b0852fcdbc;p=gosa.git Updated config registry -Keep results and prepared plugin deactivation git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18694 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_configRegistry.inc b/gosa-core/include/class_configRegistry.inc index d64d82872..1a2d7b733 100644 --- a/gosa-core/include/class_configRegistry.inc +++ b/gosa-core/include/class_configRegistry.inc @@ -23,6 +23,7 @@ class configRegistry{ public $detectedSchemaIssues = array(); public $schemaCheckFailed = FALSE; public $schemaCheckFinished = FALSE; + public $pluginsDeactivated = array(); function __construct($config) { @@ -64,6 +65,9 @@ class configRegistry{ $this->detectedSchemaIssues['missing'] = array(); $this->detectedSchemaIssues['versionMismatch'] = array(); + // Clear last results + $this->pluginsDeactivated = array(); + // Read objectClasses from ldap if(!count($this->objectClasses)){ $ldap = $this->config->get_ldap_link(); @@ -75,29 +79,43 @@ class configRegistry{ $this->pluginRequirements = array('ldapSchema' => array()); $this->categoryToClass = array(); foreach($this->classesWithInfo as $cname => $defs){ - if(isset($defs['plRequirements']['ldapSchema'])){ - $this->pluginRequirements['ldapSchema'][$cname] = $defs['plRequirements']['ldapSchema']; + if(isset($defs['plRequirements'])){ + $this->pluginRequirements[$cname] = $defs['plRequirements']; } } // Check schema requirements now $missing = $invalid = array(); - foreach($this->pluginRequirements['ldapSchema'] as $cname => $requirements){ - foreach($requirements as $oc => $version){ - 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"); - } - $this->detectedSchemaIssues['versionMismatch'] = - sprintf(_("%s has version %s but %s required!"), bold($oc),bold($currentVersion),bold($version)); + foreach($this->pluginRequirements as $cname => $requirements){ + + // Check LDAP schema requirements for this plugins + $failure = FALSE; + if(isset($requirements['ldapSchema'])){ + foreach($requirements['ldapSchema'] as $oc => $version){ + if(!$this->ocAvailable($oc)){ + $this->detectedSchemaIssues['missing'][] = $oc; $this->schemaCheckFailed = TRUE; + $failure = TRUE; + }elseif(!empty($version)){ + $currentVersion = $this->getObjectClassVersion($oc); + if(!empty($currentVersion) && !$this->ocVersionMatch($version, $currentVersion)){ + if($currentVersion == -1){ + $currentVersion = _("unknown"); + } + $this->detectedSchemaIssues['versionMismatch'] = + sprintf(_("%s has version %s but %s required!"), bold($oc),bold($currentVersion),bold($version)); + $this->schemaCheckFailed = TRUE; + $failure = TRUE; + } } } } + + // Display corresponding plugins now + if($disableIncompatiblePlugins && $failure && isset($requirements['onFailureDisablePlugin'])){ + foreach($requirements['onFailureDisablePlugin'] as $name){ + $this->pluginsDeactivated[] = $name; + } + } } $this->schemaCheckFinished =TRUE; return(!$this->schemaCheckFailed); diff --git a/gosa-core/plugins/personal/generic/class_user.inc b/gosa-core/plugins/personal/generic/class_user.inc index 94e3ed23a..cc86338b1 100644 --- a/gosa-core/plugins/personal/generic/class_user.inc +++ b/gosa-core/plugins/personal/generic/class_user.inc @@ -1691,7 +1691,8 @@ class user extends plugin 'ldapSchema' => array( 'gosaAccount' => '>=2.7', 'gosaUserTemplate' => '>=2.7' - ) + ), + 'onFailureDisablePlugin' => array('userManagement') ), "plProperties" => array(