Code

Updated workstation service saving
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 4 Jul 2008 12:11:13 +0000 (12:11 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 4 Jul 2008 12:11:13 +0000 (12:11 +0000)
- Send goto reload event, if attributes changed

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

gosa-plugins/goto/admin/systems/goto/class_workstationService.inc

index c7b73b6d07a7963083e5b1e2c349079a414a2eea..c78dc46969cb4d71a9afe3848cb293e296a45934 100644 (file)
@@ -447,6 +447,12 @@ class workservice extends plugin
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->dn);
     $this->cleanup();
+
+    /* Send goto reload event to gosaSupportDaemon */
+    if(count($this->attrs)){
+      $this->send_goto_reload(); 
+    }
+
     $ldap->modify ($this->attrs); 
     new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
     if (!$ldap->success()){
@@ -507,6 +513,34 @@ class workservice extends plugin
             ));
   }
 
+
+  /*! \brief  Send goto_reload event to support daemon
+   */
+  function send_goto_reload()
+  {
+    $targets = array();
+    if(isset($this->parent) && ($this->parent instanceOf worktabs)){
+      $targets[] = $this->parent->by_object['workgeneric']->netConfigDNS->ipHostNumber;
+    }
+    if(isset($this->parent) && ($this->parent instanceOf ogrouptabs)){
+      $member = $this->parent->by_object['ogroup']->member;
+      $oc = $this->parent->by_object['ogroup']->objcache;
+      foreach($member as $mem){
+        if(isset($oc[$mem]['macAddress'])){
+          $targets[] = $oc[$mem]['macAddress']; 
+        }
+      }
+    }
+    if(count($targets) && class_available("gosaSupportDaemon") && class_available("DaemonEvent_goto_reload")){
+      $o_g = new gosaSupportDaemon();
+      $evt = new DaemonEvent_goto_reload($this->config);
+      $evt -> set_type(TRIGGERED_EVENT);
+      $evt -> add_targets($targets);
+      $o_g->append($evt);
+    } 
+  }
+
+
   function PrepareForCopyPaste($source)
   {
     plugin::PrepareForCopyPaste($source);