Code

Updated gosaServerDeamon
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 22 Jan 2008 08:28:46 +0000 (08:28 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 22 Jan 2008 08:28:46 +0000 (08:28 +0000)
-Empty queue will no longer be interpreted as error.
-

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

gosa-core/include/class_gosaSupportDaemon.inc
gosa-core/include/class_socketClient.inc
gosa-core/plugins/addons/gotomasses/class_gotomasses.inc

index 6d29cc6d170ae080e29f22231cc3aaf109add6d4..2eba2f8eb82f6937b7ccc5bd7c56be35140b8c3b 100644 (file)
@@ -39,10 +39,11 @@ class gosaSupportDaemon
   public function connect()
   {
     $this->o_sock = new Socket_Client($this->s_host,$this->i_port,TRUE,$this->f_timeout);
-    $this->o_sock->setEncryptionKey($this->s_encryption_key); 
     if($this->o_sock->connected()){ 
+      $this->o_sock->setEncryptionKey($this->s_encryption_key); 
       $this->is_connected = TRUE;
     }else{
+      $this->error = $this->o_sock->get_error();
       $this->is_connected = FALSE;
     }
   }
@@ -99,12 +100,17 @@ class gosaSupportDaemon
       $this->o_sock->write($xml_msg);
       $str = trim($this->o_sock->read());
       $entries = $this->xml_to_array($str);
-      if(!isset($entries['XML'])){
-        $this->set_error("Couldn't parse xml.");
+
+      if(!array_key_exists("XML",$entries)){
+        $this->set_error("!!!Couldn't parse xml.");
         $this->disconnect();
         return;
       }else{
-        $ret = array_values($entries['XML']); 
+        if(!is_array($entries['XML'])) {
+          $ret = array();
+        }else{
+          $ret = $entries['XML']; 
+        }
       }
       return($ret);
     }
@@ -244,7 +250,7 @@ class gosaSupportDaemon
             $start_level++;
           }
           $php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
-          eval($php_stmt);
+          @eval($php_stmt);
         }
       }
     }
index 008308e75a12ffe19e8872c3f1b63bbba1f3a01c..6857112114b45fc0b6a1517c169ed72ac4049554 100644 (file)
@@ -172,7 +172,7 @@ class Socket_Client
                }
 
                /* Terminate decryption handle and close module */
-               mcrypt_generic_deinit($this->td);
+               @mcrypt_generic_deinit($this->td);
        }
 }
 ?>
index 2df2bd6b1a2ff9a1cc0a9a494576da085f072953..3f85caf56002b2549d6f982edbe2746bf57af612 100644 (file)
@@ -24,7 +24,7 @@ class gotomasses extends plugin
     /* Include config object */
     $this->config= &$config;
     $this->divlist = new divListMasses($this->config,$this);
-    $this->o_queue = new gosaSupportDaemon("10.3.67.111","20081","secret-gosa-password",TRUE,0.2);
+    $this->o_queue = new gosaSupportDaemon("10.3.67.111","20081","secret-gosa-password",TRUE,2);
   }
 
 
@@ -38,7 +38,7 @@ class gotomasses extends plugin
 
     $s_entry = $s_action = "";
     $arr = array( 
-        "/^stop_/"      => "stop",
+        "/^stop/"      => "stop",
         "/^stop_all/"  => "stop_all",
         "/^start/"      => "start",
         "/^start_all/"  => "start_all",
@@ -58,6 +58,8 @@ class gotomasses extends plugin
       }
     }
 
+    #print_a(array($s_entry,$s_action));;
+
     /* Edit posted from list link */
     if(isset($_GET['act']) && $_GET['act'] == "edit" && isset($_GET['id']) && isset($this->tasks[$_GET['id']])){
       $s_action = "edit";
@@ -205,7 +207,7 @@ class gotomasses extends plugin
      ************/
 
     $this->divlist->execute();
-    $entries = $this->get_queue_entries();
+    $entries = $this->get_queued_entries();
     $this->divlist->SetEntries($entries);
     return($this->divlist->Draw());
   }
@@ -254,7 +256,7 @@ class gotomasses extends plugin
   /*! \brief  Request list of queued jobs.
    *  @return Returns an array of all queued jobs.
    */
-  function get_queue_entries()
+  function get_queued_entries()
   {
     
     $entries = $this->o_queue->get_queued_entries();