From 2d1ce57a873a7e91a357d9fa07ff8bc762e2ee14 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 14 Apr 2008 07:55:52 +0000 Subject: [PATCH] Updated package list query git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10380 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_gosaSupportDaemon.inc | 100 ++++++++++++------ 1 file changed, 67 insertions(+), 33 deletions(-) diff --git a/gosa-core/include/class_gosaSupportDaemon.inc b/gosa-core/include/class_gosaSupportDaemon.inc index b33e59eb8..5f1607334 100644 --- a/gosa-core/include/class_gosaSupportDaemon.inc +++ b/gosa-core/include/class_gosaSupportDaemon.inc @@ -134,7 +134,52 @@ class gosaSupportDaemon } - public function FAI_get_packages($release,$attrs, $package = array()) + + + public function FAI_get_package_sections($release) + { + $xml_msg = "
gosa_query_packages_list
GOSAGOSA". + "". + "".$release."
"; + + if($this->connect()){ + $this->o_sock->write($xml_msg); + $str = trim($this->o_sock->read()); + + /* Check if something went wrong while reading */ + if($this->o_sock->is_error()){ + $this->set_error($this->o_sock->get_error()); + return($ret); + } + + $entries = $this->xml_to_array($str); + if(isset($entries['XML']) && is_array($entries['XML'])){ + + /* Check if returned values represent a valid answer */ + if(isset($entries['XML'])){ + if(isset($entries['XML']['ERROR_STRING'])) { + $this->set_error($entries['XML']['ERROR_STRING']); + new log("debug","GOsa-si", + get_class($this)."::".__FUNCTION__, array(), + "FAILED error was ".$this->get_error()); + return($ret); + } + + /* Unset header tags */ + foreach(array("HEADER","SOURCE","TARGET","SESSION_ID") as $type){ + if(isset($entries['XML'][$type])){ + unset($entries['XML'][$type]); + } + } + $ret = $entries['XML']; + } + } + } + return($ret); + } + + + public function FAI_get_packages($release,$attrs,$package,$from=-1,$to=-1) { $this->reset_error(); $ret = array(); @@ -157,43 +202,32 @@ class gosaSupportDaemon $attr.= ""; } + /* If no package is given, search for all */ + if(!count($package)) $package = array("%"); + + /* Create limit tag */ + if($from == -1){ + $limit =""; + }else{ + $limit = "".$from."".$to.""; + } + /* Create list of attributes to fetch */ $pkgs = ""; foreach($package as $pkg){ - $pkgs .=" - - like - ".$pkg." - - "; - + $pkgs .="like".$pkg.""; } - /* Create Daemon query */ - if(!count($package)){ - $xml_msg = "
gosa_query_packages_list
GOSAGOSA". - $attr. - "".$release." -
"; - }else{ - $xml_msg = "
gosa_query_packages_list
GOSAGOSA". - $attr. - " - - - - ".$release." - - - - - OR - ".$pkgs." - - - 0100 -
"; - } + $xml_msg = "
gosa_query_packages_list
GOSAGOSA". + $attr. + " + ".$release." + OR + ".$pkgs." + + ". + $limit. + "
"; if($this->connect()){ $this->o_sock->write($xml_msg); -- 2.30.2