summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4064fd7)
raw | patch | inline | side by side (parent: 4064fd7)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 24 Jan 2008 14:58:45 +0000 (14:58 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 24 Jan 2008 14:58:45 +0000 (14:58 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8590 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 f11f31735d24e6e67b9ba64146f9914ca089d518..537755ad0f9d2ab084f3d0dd1a5b56ab493ae702 100644 (file)
$this->is_connected = TRUE;
}else{
$this->error = $this->o_sock->get_error();
- $this->is_connected = FALSE;
+ $this->disconnect();
}
+ return($this->is_connected);
}
{
$this->b_error = FALSE;
$this->s_error = "";
+ $ret = array();
$xml_msg = "<xml>
<header>gosa_query_jobdb</header>
</limit>
</xml>";
- $this->connect();
- if($this->is_connected){
+ if($this->connect()){
$this->o_sock->write($xml_msg);
$str = trim($this->o_sock->read());
$entries = $this->xml_to_array($str);
-
- if(!array_key_exists("XML",$entries)){
- $this->set_error("!!!Couldn't parse xml.");
- $this->disconnect();
- return;
- }else{
- if(!is_array($entries['XML'])) {
- $ret = array();
- }else{
- $ret = $entries['XML'];
- }
+ if(isset($entries['XML']) && is_array($entries['XML'])){
+ $ret = $entries;
}
- return($ret);
}
- $this->set_error("Could not establish socket connection.");
- $this->disconnect();
- return;
+ return($ret);
}
/*! \brief Checks if the given ids are used queue ids.
</where>
</xml>";
- $this->connect();
- if(!$this->is_connected){
- $this->set_error("Could not establish socket connection.");
- }else{
+ if($this->connect()){
$this->o_sock->write($xml_msg);
$str = trim($this->o_sock->read());
- $entries = $this->xml_to_array($str);
- if(isset($entries['XML'])){
+ $entries = $this->xml_to_array($str);
+ if(isset($entries['XML']) && is_array($entries['XML'])){
foreach($entries['XML'] as $entry){
$ret[] = $entry['ID'];
}
- $this->disconnect();
- return($ret);
}
}
- $this->disconnect();
- return(FALSE);
+ return($ret);
}
</where>
</xml>";
- $this->connect();
- if(!$this->is_connected){
- $this->set_error("Could not establish socket connection.");
- }else{
+ if($this->connect()){
$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("Entry with id (".$id.") not found.");
- $this->disconnect();
- }else{
+ if(isset($entries['XML'])){
$ret = $entries['XML'];
- return($ret);
}
}
- return;
+ return($ret);
}
</clause>
</where>
</xml>";
- $this->connect();
- if(!$this->is_connected){
- $this->set_error("Could not establish socket connection.");
- }else{
+
+ if($this->connect()){
$this->o_sock->write($xml_msg);
$str = trim($this->o_sock->read());
$entries = $this->xml_to_array($str);
if(isset($entries['XML']['ANSWER1'])){
- $this->disconnect();
return(TRUE);
}
}
- $this->disconnect();
return(FALSE);
}
$this->b_error = FALSE;
$this->s_error = "";
+ $ret = array();
$xml_msg = "<xml>
<header>gosa_query_jobdb</header>
<where>
</clause>
</where>
</xml>";
- $this->connect();
- if(!$this->is_connected){
- $this->set_error("Could not establish socket connection.");
- }else{
+ if($this->connect()){
$this->o_sock->write($xml_msg);
$str = trim($this->o_sock->read());
$entries = $this->xml_to_array($str);
if(!isset($entries['XML']['ANSWER1'])){
- $this->set_error("Entry with id (".$id.") not found.");
- $this->disconnect();
- }else{
$ret = $entries['XML']['ANSWER1'];
- return($ret);
}
}
- return;
+ return($ret);
}
$this->b_error = FALSE;
$this->s_error = "";
- $this->connect();
- if($this->is_connected){
+ if($this->connect()){
$this->o_sock->write($xml_msg);
- return(TRUE);
+ $str = $this->o_sock->read();
+ $entries = $this->xml_to_array($str);
+ if(isset($entries['XML'])){
+ return(TRUE);
+ }
}
- $this->set_error("Could not establish socket connection.");
return(FALSE);
}
</clause>
</where>
</xml>";
- $this->connect();
- if($this->is_connected){
+ if($this->connect()){
$this->o_sock->write($xml_msg);
- return(TRUE);
+ $str = $this->o_sock->read();
+ $entries = $this->xml_to_array($str);
+ if(isset($entries['XML'])){
+ return(TRUE);
+ }
}
- $this->set_error("Could not establish socket connection.");
return(FALSE);
}
$err_id = xml_get_error_code($parser);
if($err_id){
- $this->set_error(xml_error_string(xml_get_error_code($parser)));
xml_parser_free($parser);
}else{
xml_parser_free($parser);
}
}
}
+ if(!isset($params['XML'])){
+ $this->set_error(_("Could not parse XML."));
+ $params = array();
+ }
return($params);
}
".$attr."
</update>
</xml>";
- $this->connect();
- if($this->is_connected){
+ if($this->connect()){
$this->o_sock->write($xml_msg);
$str = trim($this->o_sock->read());
$entries = $this->xml_to_array($str);
- if(!empty($str)){
+ if(isset($entries['XML'])){
return(TRUE);
}
- return(FALSE);
}
- $this->set_error("Could not establish socket connection.");
return(FALSE);
}
{
$xml_msg ="<xml> <header>gosa_count_jobdb</header></xml>";
$this->connect();
- if($this->is_connected){
+ if($this->connect()){
$this->o_sock->write($xml_msg);
- $str = trim($this->o_sock->read());
+ $str = trim($this->o_sock->read());
$entries = $this->xml_to_array($str);
- if(isset($entries['XML']['COUNT'])){
+ if(isset($entries['XML'])){
return($entries['XML']['COUNT']);
}
- return;
}
- $this->set_error("Could not establish socket connection.");
- return;
+ return(-1);
}
}