Code

Only reload FAI classes, if a class was added or removed
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Apr 2008 10:04:11 +0000 (10:04 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Apr 2008 10:04:11 +0000 (10:04 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10533 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/class_FAI.inc

index 14bf01cd06f7905f8d2f166cf51864cf5bd3daa6..b0677537f6d7196d23ecb99906f667829413fe2e 100644 (file)
@@ -295,6 +295,8 @@ class FAI
     global $config;
     /* Variable init*/
     $to_save = array();
+    
+    $reload_fai_classes = FALSE;
 
     /* check which objects must be saved */
     $FAI_objects_to_save = session::get('FAI_objects_to_save');
@@ -378,6 +380,12 @@ class FAI
           }else{
             $objectAttrs['FAIstate'][0] = "|removed";
           }
+
+          /* Force reload of FAI classes */
+          $classes = array("FAIprofile","FAIscript","FAIpackageList","FAIpartitionTable","FAIHook","FAIvariable","FAItemplate");
+          if(count(array_intersect($classes,$objectAttrs['objectClass']))){
+            $reload_fai_classes = TRUE;
+          }
         }
       }
 
@@ -390,6 +398,13 @@ class FAI
           print_a($objectAttrs);
         }
         FAI::save_FAI_object($Current_DN,$objectAttrs);
+
+        /* Force reload of FAI classes */
+        $classes = array("FAIprofile","FAIscript","FAIpackageList","FAIpartitionTable","FAIHook","FAIvariable","FAItemplate");
+        if(count(array_intersect($classes,$objectAttrs['objectClass']))){
+          $reload_fai_classes = TRUE;
+        }
+
       }else{
 
         /* This object is inherited by some sub releases */  
@@ -404,6 +419,12 @@ class FAI
         /* New objects require special handling */
         if($is_new){
 
+          /* Force reload of FAI classes */
+          $classes = array("FAIprofile","FAIscript","FAIpackageList","FAIpartitionTable","FAIHook","FAIvariable","FAItemplate");
+          if(count(array_intersect($classes,$objectAttrs['objectClass']))){
+            $reload_fai_classes = TRUE;
+          }
+
           /* check if there is already an entry named like this,
              in one of our parent releases */
           if(!empty($parent_obj)){
@@ -472,8 +493,8 @@ class FAI
 
     /* Reload GOsa si FAI DB/cache
      */
-    if(count($to_save)){
-      if(class_available("DaemonEvent") && class_available("gosaSupportDaemon")){
+    if($reload_fai_classes){
+      if( class_available("DaemonEvent") && class_available("gosaSupportDaemon")){
         $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);        
         if(isset($events['TRIGGERED']['DaemonEvent_recreate_fai_release_db'])){
           $evt = $events['TRIGGERED']['DaemonEvent_recreate_fai_release_db'];