Code

Updated repository service
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 15 Apr 2008 09:22:45 +0000 (09:22 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 15 Apr 2008 09:22:45 +0000 (09:22 +0000)
-Send reload event to si, if the repositories have changed

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

gosa-plugins/goto/admin/systems/services/repository/class_servRepository.inc

index 265d825fc02299e7ce878359d5e2d6c5721386c2..734618ef671fd68545f856d8e7caeaeda8938962 100644 (file)
@@ -307,14 +307,19 @@ class servrepository extends goService
       $ldap->cd($this->dn);
       $this->cleanup();
       $ldap->modify ($this->attrs);       
-
       $this->handle_post_events("modify");
+      if(count($this->attrs)){
+        $this->trigger_si_fai_server_reload();
+      }
     }else{
       $ldap->cd ($this->config->current['BASE']);
       $ldap->create_missing_trees($this->dn);
       $ldap->cd($this->dn);
       $ldap->add($this->attrs);
       $this->handle_post_events("add");
+      if(count($this->attrs)){
+        $this->trigger_si_fai_server_reload();
+      }
     }
 
     if($this->initially_was_account){
@@ -334,6 +339,33 @@ class servrepository extends goService
     return($fields);
   }
 
+
+  function trigger_si_fai_server_reload()
+  {
+    /* Reload GOsa si FAI DB/cache
+     */
+    if(class_available("DaemonEvent") && class_available("gosaSupportDaemon")){
+      $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);        
+      if(isset($events['TRIGGERED']['DaemonEvent_recreate_fai_server_db'])){
+        $evt = $events['TRIGGERED']['DaemonEvent_recreate_fai_server_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);
+        }
+      }
+    }
+  }
+
+
+  function remove_from_parent()
+  {
+    goService::remove_from_parent();
+    $this->trigger_si_fai_server_reload();
+  }
+
   /* Return plugin informations for acl handling */
   static function plInfo()
   {