Code

Updated workservice (Devices)
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 11 Sep 2008 09:54:08 +0000 (09:54 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 11 Sep 2008 09:54:08 +0000 (09:54 +0000)
-Added event DaemonEvent_goto_reload if something has changed

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

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

index 4ce1742fe2c9ab770957eb8485dff2451ee46492..d9580d3b9bea6956ab599a957dda7da3dba6e8b4 100644 (file)
@@ -448,6 +448,51 @@ class workservice extends plugin
     $ldap->cd($this->dn);
     $this->cleanup();
 
+    /* Send SI event to reload goto settings if some options have changed.
+     */
+    if(count($this->attrs) && class_available("DaemonEvent")){
+      $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
+
+      $o_queue = new gosaSupportDaemon();
+      if(isset($events['TRIGGERED']['DaemonEvent_goto_reload'])){
+        $evt = $events['TRIGGERED']['DaemonEvent_goto_reload'];
+        $macs = array();
+
+        /* Get list of macAddresses 
+         */
+        if(isset($this->parent->by_object['ogroup'])){
+
+          /* If we are an object group, add all member macs 
+           */
+          $p = $this->parent->by_object['ogroup'];
+          foreach($p->memberList as $dn => $obj){
+            if(isset($p->objcache[$dn]['macAddress']) && !empty($p->objcache[$dn]['macAddress'])){
+              $macs[] = $p->objcache[$dn]['macAddress'];
+            }
+          }
+        }elseif(isset($this->parent->by_object['workgeneric']->netConfigDNS->macAddress)){
+
+          /* We are a workstation. Add current mac.
+           */
+          $mac = $this->parent->by_object['workgeneric']->netConfigDNS->macAddress;
+          if(!empty($mac)){
+            $macs[] = $mac;
+          }          
+        }
+
+        /* Trigger event for all member objects 
+         */
+        if(count($macs)){
+          $tmp = new $evt['CLASS_NAME']($this->config);
+          $tmp->set_type(TRIGGERED_EVENT);
+          $tmp->add_targets($macs);
+          if(!$o_queue->append($tmp)){
+            msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
+          }
+        }
+      }
+    }
+
     /* Send goto reload event to gosaSupportDaemon */
     if(count($this->attrs)){
       $this->send_goto_reload();