summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3af536a)
raw | patch | inline | side by side (parent: 3af536a)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 6 Mar 2008 15:10:20 +0000 (15:10 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 6 Mar 2008 15:10:20 +0000 (15:10 +0000) |
-Added a new function that allows to remove all entries with a specific mac
--Processing entries will be canceled via break job.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9395 594d385d-05f5-0310-b6e9-bd551577e9d8
--Processing entries will be canceled via break job.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9395 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_gosaSupportDaemon.inc | patch | blob | history |
diff --git a/gosa-core/include/class_gosaSupportDaemon.inc b/gosa-core/include/class_gosaSupportDaemon.inc
index 803ff31c943600e1d22b6d2a543ed858df47de99..c8a05a09f24aad79cc17bf1e4df5f68501983c4c 100644 (file)
$this->o_sock->write($xml_msg);
$str = $this->o_sock->read();
$entries = $this->xml_to_array($str);
- if(isset($entries['XML'])){
+ if(isset($entries['XML']) || isset($entries['COUNT'])){
return(TRUE);
}
}
}
+ /*! \brief Removes all jobs from the queue that are tiggered with a specific macAddress.
+ @param String $mac The mac address for which we want to remove all jobs.
+ */
+ function clean_queue_from_mac($mac)
+ {
+ global $config;
+
+ /* First of all we have to check which jobs are startet
+ * for $mac
+ */
+ $xml_msg ="
+ <xml>
+ <header>gosa_query_jobdb</header>
+ <target>GOSA</target>
+ <source>GOSA</source>
+ <where>
+ <clause>
+ <phrase>
+ <macaddress>".$mac."</macaddress>
+ </phrase>
+ </clause>
+ </where>
+ </xml>
+ ";
+
+ $data = $this->_send($xml_msg,TRUE);
+ if(is_array($data) && isset($data['XML'])){
+ $already_aborted = FALSE;
+ foreach($data['XML'] as $name => $entry){
+ if(preg_match("/answer[0-9]*/i",$name)){
+ $entry['STATUS'] = strtoupper($entry['STATUS']);
+ switch($entry['STATUS']){
+
+ case 'PROCESSING' :
+
+ /* Send abort event, but only once
+ */
+ if($already_aborted){
+ break;
+ }elseif(class_available("DaemonEvent_faireboot")){
+ $already_aborted = TRUE;
+ $tmp = new DaemonEvent_faireboot($config);
+ $tmp->add_targets(array($mac));
+ $tmp->set_type(TRIGGERED_EVENT);
+ if(!$this->append($tmp)){
+ msg_dialog::display(_("Error"), sprintf(_("Cannot send abort event for entry: %s"),$entry['ID']) , ERROR_DIALOG);
+ }
+ ;break;
+ }else{
+ /* Couldn't find abort event, just remove entry */
+ }
+
+ case 'WAITING':
+ case 'ERROR':
+ default :
+
+ /* Simply remove entries from queue.
+ * Failed or waiting events, can be removed without any trouble.
+ */
+ if(!$this->remove_entries(array($entry['ID']))){
+ msg_dialog::display(_("Error"), sprintf(_("Cannot remove entry: %s"),$entry['ID']) , ERROR_DIALOG);
+ }
+ ;break;
+ }
+
+ }
+ }
+ }
+ }
+
+
static function ping($target)
{
if (tests::is_mac($target)){