summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 06ad7b1)
raw | patch | inline | side by side (parent: 06ad7b1)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 12 Sep 2008 06:33:26 +0000 (06:33 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 12 Sep 2008 06:33:26 +0000 (06:33 +0000) |
-Just set debug level to 256.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12437 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12437 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 0c99d158c203c0942d16894f7baeba9632978b05..bea358f72903078d111d8c4650f8100d645fd409 100644 (file)
*/
private function set_error($str)
{
+ /******
+ Debug handling
+ ******/
+ $debug = debug_backtrace();
+ $file = __FILE__;
+ $function = __FUNCTION__;
+ $line = __LINE__;
+ $class = __CLASS__;
+ foreach($debug as $info){
+ if(!in_array($info['function'],array("send_data","_send","set_error"))){
+ $file = $info['file'];
+ $line = $info['line'];
+ $class = get_class($this);
+ $function = $info['function'];
+ break;
+ }
+ }
+ @DEBUG(GOSA_SI, $line, "<b>".$class."::".$function."</b>" , $file, "<font color='red'><i>".htmlentities($str)."</i></font>", $info="");
+
+ /******
+ Set error string.
+ ******/
+
$this->b_error = TRUE;
$this->s_error = $str;
}
$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->_send($xml_msg,TRUE);
- $entries = $this->xml_to_array($str);
+ /* Check if returned values represent a valid answer */
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 */
$ret = $entries['XML'];
foreach($ret as $key => $entry){
if(!preg_match("/^answer/i",$key)){
$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);
+ $entries = $this->_send($xml_msg,TRUE);
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]);
- }
+ /* Unset header tags */
+ foreach(array("HEADER","SOURCE","TARGET","SESSION_ID") as $type){
+ if(isset($entries['XML'][$type])){
+ unset($entries['XML'][$type]);
}
- $ret = $entries['XML'];
}
+ $ret = $entries['XML'];
}
}
return($ret);
public function FAI_get_packages($release,$attrs,$package,$from=-1,$to=-1)
{
- $this->reset_error();
$ret = array();
/* Check Parameter */
"</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);
+ $entries = $this->_send($xml_msg,TRUE);
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){
public function FAI_get_server($name = "")
{
- $this->reset_error();
$xml_msg = "<xml><header>gosa_query_fai_server</header><target>GOSA</target><source>GOSA</source></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);
+ /* Check if returned values represent a valid answer */
+ $entries = $this->_send($xml_msg,TRUE);
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]);
- }
+ /* Unset header tags */
+ foreach(array("HEADER","SOURCE","TARGET","SESSION_ID") as $type){
+ if(isset($entries['XML'][$type])){
+ unset($entries['XML'][$type]);
}
- $ret = $entries['XML'];
}
+ $ret = $entries['XML'];
}
}
return($ret);
public function FAI_get_classes($name)
{
- $this->reset_error();
$xml_msg = "<xml><header>gosa_query_fai_release</header><target>GOSA</target><source>GOSA</source>".
"<where><clause><phrase><release>".$name."</release></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);
+ $entries = $this->_send($xml_msg,TRUE);
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($name),
- "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]);
- }
+ /* Unset header tags */
+ foreach(array("HEADER","SOURCE","TARGET","SESSION_ID") as $type){
+ if(isset($entries['XML'][$type])){
+ unset($entries['XML'][$type]);
}
- $ret = $entries['XML'];
}
+ $ret = $entries['XML'];
}
}
return($ret);
*/
public function get_queued_entries($event_types = array("*"),$from=-1,$to=-1,$sort="timestamp DESC")
{
- $this->reset_error();
$ret = array();
$tags = "";
</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);
+ $entries = $this->_send($xml_msg,TRUE);
if(isset($entries['XML']) && is_array($entries['XML'])){
- /* Check if returned values represent a valid answer */
- if(isset($entries['XML'])){
-
- /* Unset header tags */
- foreach(array("HEADER","SOURCE","TARGET") as $type){
- unset($entries['XML'][$type]);
- }
- $ret = $entries['XML'];
+ /* Unset header tags */
+ foreach(array("HEADER","SOURCE","TARGET","SESSION_ID") as $type){
+ unset($entries['XML'][$type]);
}
+ $ret = $entries['XML'];
}
}
-
- /* Remove session ID. No one is interested in this... */
- unset($ret['SESSION_ID']);
-
return($ret);
}
trigger_error("Requires an array as parameter.");
return;
}
- $this->reset_error();
$ret = array();
</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);
+ $entries = $this->_send($xml_msg,TRUE);
if(isset($entries['XML']) && is_array($entries['XML'])){
foreach($entries['XML'] as $entry){
if(is_array($entry) && array_key_exists("ID",$entry)){
trigger_error("Requires an array as parameter.");
return;
}
- $this->reset_error();
$ret = array();
</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);
+ $entries = $this->_send($xml_msg,TRUE);
if(isset($entries['XML'])){
foreach($entries['XML'] as $name => $entry){
if(preg_match("/^ANSWER[0-9]*$/",$name)){
trigger_error("Requires an array as parameter.");
return;
}
- $this->reset_error();
$ret = array();
</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);
+ $entries = $this->_send($xml_msg,TRUE);
if(isset($entries['XML'])){
foreach($entries['XML'] as $name => $entry){
if(preg_match("/^ANSWER[0-9]*$/",$name)){
return;
}
- $this->reset_error();
$xml_msg = "<xml>
<header>gosa_query_jobdb</header>
</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(FALSE);
- }
-
- $entries = $this->xml_to_array($str);
+ $entries = $this->_send($xml_msg,TRUE);
if( isset($entries['XML']['HEADER']) &&
$entries['XML']['HEADER']=="answer" &&
isset($entries['XML']['ANSWER1'])){
trigger_error("Requires an integer as parameter.");
return;
}
- $this->reset_error();
$ret = array();
$xml_msg = "<xml>
</where>
</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);
+ $entries = $this->_send($xml_msg,TRUE);
if( isset($entries['XML']['HEADER']) &&
$entries['XML']['HEADER']=="answer" &&
isset($entries['XML']['ANSWER1'])){
return;
}
- $this->reset_error();
$ret = array();
</xml>";
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);
+ $entries = $this->_send($xml_msg,TRUE);
if(isset($entries['XML']) || isset($entries['COUNT'])){
new log("debug","DaemonEvent (IDS) ", "gosaSupportDaemon::remove_entries()", $ids,"SUCCESS");
return(TRUE);
*/
public function update_entries($ids,$data)
{
- $this->reset_error();
if(!is_array($ids)){
trigger_error("Requires an array as first parameter.");
return;
</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(FALSE);
- }
-
- $entries = $this->xml_to_array($str);
+ $entries = $this->_send($xml_msg,TRUE);
if(isset($entries['XML'])){
if(isset($entries['XML']['ERROR_STRING'])) {
$this->set_error($entries['XML']['ERROR_STRING']);
$xml_msg ="<xml><header>gosa_count_jobdb</header><target>GOSA</target><source>GOSA</source></xml>";
$this->connect();
if($this->connect()){
- $this->o_sock->write($xml_msg);
- $str = trim($this->o_sock->read());
-
- /* Check if something went wrong while reading */
+ $entries = $this->_send($xml_msg,TRUE);
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']);
}
return(FALSE);
}
- $this->reset_error();
/* Add to queue if new
*/
}
-/*! \brief Returns an array containing all queued entries.
+ /*! \brief Returns an array containing all queued entries.
@return Array All queued entries as an array.
*/
public function _send($data, $answer_expected= FALSE)
$this->reset_error();
$ret = array();
+ /******
+ Debug handling
+ ******/
+ $debug = debug_backtrace();
+ $file = __FILE__;
+ $function = __FUNCTION__;
+ $line = __LINE__;
+ $class = __CLASS__;
+ foreach($debug as $info){
+ if(!in_array($info['function'],array("send_data","_send"))){
+ $file = $info['file'];
+ $line = $info['line'];
+ $class = get_class($this);
+ $function = $info['function'];
+ break;
+ }
+ }
+ @DEBUG(GOSA_SI, $line, "<b>".$class."::".$function."</b>" , $file, "<i>".htmlentities($data)."</i>", $info="");
+
+
+ /*******
+ Start sending data
+ *******/
if($this->connect()){
$this->o_sock->write($data);
if ($answer_expected){