diff --git a/gosa-core/include/class_gosaSupportDaemon.inc b/gosa-core/include/class_gosaSupportDaemon.inc
index af43e3bee169902dae458a7eaebed94528e78e95..b6eff67e502b5a1766dfa5d08a4a963bbf652796 100644 (file)
}else{
$this->set_error($this->o_sock->get_error());
$this->disconnect();
- new log("debug","gosaSupportDaemon::connect()", "Could not connect to server.", array(),$this->get_error());
+ new log("debug","gosaSupportDaemon::connect()", "Cannot connect to si-server", array(),$this->get_error());
}
}else{
$this->set_error(msgPool::cmdnotfound("GOSA_SI",_("GOsa support daemon")));
}
- public function FAI_get_packages($release)
+ public function FAI_get_packages($release,$attrs, $package="")
{
$this->reset_error();
+ $ret = array();
- $xml_msg = "<xml><header>gosa_query_packages_list</header><target>GOSA</target><source>GOSA</source>".
- "<where><clause><phrase><distribution>".$release."</distribution></phrase></clause></where></xml>";
+ /* Check Parameter */
+ if(!is_array($attrs) || !count($attrs)){
+ trigger_error("Second parameter must be an array. With at least one attribute name.");
+ return($ret);
+ }
+
+ /* Create list of attributes to fetch */
+ $attr = "";
+ foreach($attrs as $at){
+ $attr.= $at.", ";
+ }
+
+ /* Create Daemon query */
+ if(empty($package)){
+ $xml_msg = "<xml><header>gosa_query_packages_list</header><target>GOSA</target><source>GOSA</source>".
+ "<select> ".trim($attr,", ")." </select>".
+ "<where><clause><phrase><distribution>".$release."</distribution></phrase></clause></where>
+ </xml>";
+ }else{
+ $xml_msg = "<xml><header>gosa_query_packages_list</header><target>GOSA</target><source>GOSA</source>".
+ "<select> ".trim($attr,", ")." </select>".
+ "<where><clause>
+ <connector>AND</connector>
+ <phrase><distribution>".$release."</distribution></phrase>
+ <phrase><package>".$package."</package></phrase>
+ </clause></where>
+ </xml>";
+ }
- $ret = array();
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'])){
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'])){
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'])){
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'])){
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'])){
foreach($entries['XML'] as $entry){
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'])){
foreach($entries['XML'] as $name => $entry){
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'])){
foreach($entries['XML'] as $name => $entry){
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(FALSE);
+ }
+
$entries = $this->xml_to_array($str);
if( isset($entries['XML']['HEADER']) &&
$entries['XML']['HEADER']=="answer" &&
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']['HEADER']) &&
$entries['XML']['HEADER']=="answer" &&
if($this->connect()){
$this->o_sock->write($xml_msg);
$str = $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']) || isset($entries['COUNT'])){
new log("debug","DaemonEvent (IDS) ", "gosaSupportDaemon::remove_entries()", $ids,"SUCCESS");
$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(FALSE);
+ }
+
$entries = $this->xml_to_array($str);
if(isset($entries['XML'])){
if(isset($entries['XML']['ERROR_STRING'])) {
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(0);
+ }
+
$entries = $this->xml_to_array($str);
if(isset($entries['XML'])){
return($entries['XML']['COUNT']);
$this->o_sock->write($data);
if ($answer_expected){
$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'])){
$ret = $entries;