Code

Added mechanisms to disable/deactivate plugins if requirements are not fulfilled.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 26 May 2010 06:19:04 +0000 (06:19 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 26 May 2010 06:19:04 +0000 (06:19 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18698 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_configRegistry.inc
gosa-core/include/class_pluglist.inc
gosa-core/include/functions.inc

index 33b033b69d798c1ea74e2f87fac4b99e76d37f29..db6d30fb7c30cc8e77bb033a6be5bf229eca99df 100644 (file)
@@ -97,7 +97,7 @@ class configRegistry{
             $failure = FALSE;
             if(isset($requirements['ldapSchema'])){
                 foreach($requirements['ldapSchema'] as $oc => $version){
-                    if(!$this->ocAvailable($oc)){
+                    if(1 || !$this->ocAvailable($oc)){
                         $this->detectedSchemaIssues['missing'][] = $oc;
                         $this->schemaCheckFailed = TRUE;
                         $failure = TRUE;
@@ -119,14 +119,21 @@ class configRegistry{
             // Display corresponding plugins now 
             if($disableIncompatiblePlugins && $failure && isset($requirements['onFailureDisablePlugin'])){
                 foreach($requirements['onFailureDisablePlugin'] as $name){
-                    $this->pluginsDeactivated[] = $name;
+                    $this->pluginsDeactivated[$name] = $name;
                 } 
             }
         }
         $this->schemaCheckFinished =TRUE;
+        session::un_set('plist');
         return(!$this->schemaCheckFailed);
     }
 
+    
+    function getDisabledPlugins()
+    {
+        return($this->pluginsDeactivated);
+    }
+
         
     function displayErrors()
     {
index 0f89f3b611bb05aeda5ba7c67a386a0236578d9b..3bf9caa74ca2b79abf2746b4fd7f761847c85282 100644 (file)
@@ -186,10 +186,13 @@ class pluglist
         }
       }
 
+        $disabledPlugins = $this->config->configRegistry->getDisabledPlugins();
+
       $cfg= $this->config->data['MENU'];
       $menu = "\n      <div class='navigation'>";
       foreach ($cfg as $headline => $plug){
 
+
         if(!count($plug)) continue;
 
         $menu.= "\n        <div class='menu'>";
@@ -198,6 +201,9 @@ class pluglist
         $id = 0;
         foreach ($plug as $info){
 
+            // The Plugin has been deactivated for some reason, perhabs a missing ldap schema.
+            if(isset($disabledPlugins[$info['CLASS']])) continue;
+
           // Used to detect the last element in the menu
           $id ++;
 
index 5bd288d1f3635a118b0ed18c8bc6b4d1f25a57e2..da98e1f39e56afda8c68a36086a29a6c2780d7bb 100644 (file)
@@ -144,8 +144,14 @@ spl_autoload_register('__gosa_autoload');
  */
 function class_available($name)
 {
-  global $class_mapping;
-  return(isset($class_mapping[$name]));
+  global $class_mapping, $config;
+    
+  $disabled = array();
+  if($config instanceOf config && $config->configRegistry instanceOf configRegistry){
+    $disabled = $config->configRegistry->getDisabledPlugins();
+  }
+
+  return(isset($class_mapping[$name]) && !isset($disabled[$name]));
 }