X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_hostActionQueue.inc;h=c32be66ae6821f9ddc0803b84ccebfa239378808;hb=7da42021bacbd916f09c39b742509482c185c699;hp=cbebb11ea2207fb96391581e689b35a3fb6a9b01;hpb=a47eef215bac68f5fc93ca3bf0a0d878ade4c802;p=gosa.git diff --git a/include/class_hostActionQueue.inc b/include/class_hostActionQueue.inc index cbebb11ea..c32be66ae 100644 --- a/include/class_hostActionQueue.inc +++ b/include/class_hostActionQueue.inc @@ -63,8 +63,6 @@ class hostActionQueue { $this->s_error = ""; $this->i_pointer = 0; - $this->get_new_id(); - /* Check file accessibility */ if(!file_exists($this->s_queue_file)){ $this->set_error(sprintf(_("Can't locate gotomasses queue file '%s'."),$this->s_queue_file)); @@ -112,26 +110,26 @@ class hostActionQueue { continue; } - $entry_id = $task_id= 0; + $entry_id = $task_id= ""; /* Comment must be set correctly */ if(empty($comment)){ $desc = ""; }else{ - $task_id =preg_replace("/^.*taskid:([0-9]*).*$/","\\1",$comment); - $entry_id=preg_replace("/^.*entryid:([0-9]*).*$/","\\1",$comment); + $task_id =preg_replace("/^.*taskid:([0-9a-z]*).*$/i","\\1",$comment); + $entry_id=preg_replace("/^.*entryid:([0-9a-z]*).*$/i","\\1",$comment); $desc =preg_replace("/^.*desc:(.*)$/","\\1",$comment); } - if($task_id == 0 || empty($task_id)){ - $task_id = preg_replace("/[^0-9]*/","",microtime()); + if($task_id == "" || empty($task_id)){ + $task_id = $this->get_new_id(); } - if($entry_id == 0 || empty($entry_id)){ - $entry_id = preg_replace("/[^0-9]*/","",microtime()); + if($entry_id == "" || empty($entry_id)){ + $entry_id = $this->get_new_id(); } /* Get unige id */ while(in_array($entry_id,$used_ids)){ - $entry_id = preg_replace("/[^0-9]*/","",microtime()); + $entry_id = $this->get_new_id(); } $used_ids[] = $entry_id; @@ -172,8 +170,8 @@ class hostActionQueue { } $entry['Comment'] = $desc; $this->a_queue[] = $entry; - } + $comment = ""; } /* Udpate ENTRY_ID -> id mapping */ @@ -256,14 +254,14 @@ class hostActionQueue { return(TRUE); } - private function _add_entry($entry,$task_id = 0) + private function _add_entry($entry,$task_id = "") { - if($task_id == 0 || empty($task_id)){ - $task_id=preg_replace("/[^0-9]*/","",microtime()); + if($task_id == "" || empty($task_id)){ + $task_id = $this->get_new_id(); } $entry['TASK_ID'] = $task_id; if(!isset($entry['ID']) || empty($entry['ID']) || !isset($entry['ID']) || empty($entry['ID'])){ - $entry['ID'] = preg_replace("/[^0-9]*/","",microtime()); + $entry['ID'] = $this->get_new_id(); } $this->a_queue[] = $entry; @@ -316,7 +314,7 @@ class hostActionQueue { public function add_multiple($array) { - $task_id = preg_replace("/[^0-9]*/","",microtime()); + $task_id = $this->get_new_id(); foreach($array as $entry){ if(!$this->_add_entry($entry,$task_id)){ return(FALSE); @@ -445,6 +443,10 @@ class hostActionQueue { private function get_new_id() { + $mt = microtime(); + $sec = preg_replace("/^0.([0-9]*) ([0-9]*)$/","\\2",$mt); + $msec = preg_replace("/^0.([0-9]*) ([0-9]*)$/","\\1",$mt); + return(strtoupper(base_convert($sec,10,36).base_convert($msec,10,36))); } public function min_entry_priority($id)