Code

Updated FAI saving
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 15 Apr 2008 09:16:05 +0000 (09:16 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 15 Apr 2008 09:16:05 +0000 (09:16 +0000)
-Reload FAI release database if a the classes have changed

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

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

index eb01e71de430a2b9738e9d3581bd3b560013e782..14bf01cd06f7905f8d2f166cf51864cf5bd3daa6 100644 (file)
@@ -292,6 +292,7 @@ class FAI
   /* check which objects must be saved, and save them */
   static function save_release_changes_now()
   {
+    global $config;
     /* Variable init*/
     $to_save = array();
 
@@ -335,7 +336,6 @@ class FAI
       $objectAttrs= $save['objectAttrs'];
 
       /* Get ldap object */ 
-      global $config;
       $ldap = $config->get_ldap_link();
       $ldap->cd($config->current['BASE']);
 
@@ -468,7 +468,26 @@ class FAI
           }
         }
       }
-    } 
+    }
+
+    /* Reload GOsa si FAI DB/cache
+     */
+    if(count($to_save)){
+      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']; 
+          $tmp = new $evt['CLASS_NAME']($config);
+          $tmp->set_type(TRIGGERED_EVENT);
+          $tmp->add_targets(array("GOsa"));
+          $o_queue = new gosaSupportDaemon();
+          if(!$o_queue->append($tmp)){
+            msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
+          }
+        }
+      }
+    }
+
     session::set('FAI_objects_to_save',array());
   }