Code

Updated config registry
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 25 May 2010 14:09:07 +0000 (14:09 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 25 May 2010 14:09:07 +0000 (14:09 +0000)
-Keep results and prepared plugin deactivation

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18694 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_configRegistry.inc
gosa-core/plugins/personal/generic/class_user.inc

index d64d82872403452da0e4ab53659d982d24d8abd9..1a2d7b733f522a99d533df5f80068f5387d71f08 100644 (file)
@@ -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);
index 94e3ed23a0c52144fb78450c0effeb1e9c833e5f..cc86338b105b57f8e9f0d685543b659830066c50 100644 (file)
@@ -1691,7 +1691,8 @@ class user extends plugin
             'ldapSchema' => array(
                 'gosaAccount' => '>=2.7',
                 'gosaUserTemplate' => '>=2.7'
-                )
+                ),
+            'onFailureDisablePlugin' => array('userManagement')
             ),
 
         "plProperties" => array(