From 7986b986af1b554341e0eb660ea441793c4ec4b6 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 4 Dec 2007 09:39:24 +0000 Subject: [PATCH] Added logging to phone account git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7994 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../gofon/phoneaccount/class_phoneAccount.inc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc index b35d41960..6871854ed 100644 --- a/plugins/gofon/phoneaccount/class_phoneAccount.inc +++ b/plugins/gofon/phoneaccount/class_phoneAccount.inc @@ -265,8 +265,12 @@ class phoneAccount extends plugin $r_con = @mysql_pconnect($cur_cfg['SERVER'],$cur_cfg['LOGIN'],$cur_cfg['PASSWORD']); if($r_con){ $r_db = @mysql_select_db($cur_cfg['DB'],$r_con); - $vp = mysql_fetch_row(mysql_query("SELECT ".$cur_cfg['VOICE_TABLE'].".password FROM ".$cur_cfg['VOICE_TABLE'].", ".$cur_cfg['SIP_TABLE']." WHERE customer_id = sip_users.mailbox AND name='".$this->uid."'")); + + $query_tmp = "SELECT ".$cur_cfg['VOICE_TABLE'].".password FROM ".$cur_cfg['VOICE_TABLE'].", ". + $cur_cfg['SIP_TABLE']." WHERE customer_id = sip_users.mailbox AND name='".$this->uid."'"; + $vp = mysql_fetch_row(mysql_query($query_tmp)); + @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query_tmp, "Database query"); if((isset($vp[0]))&&(!empty($vp[0]))){ $this->goFonPINVoice = $vp[0]; } @@ -482,6 +486,7 @@ class phoneAccount extends plugin if($old_connection){ $query = "SELECT id,name,callerid FROM ".$a_Remove['SIP_TABLE']." WHERE name='".$this->uid."';"; $rid = mysql_query($query,$old_connection); + @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query"); /* Old entry found, remove it */ $query_a = array(); @@ -495,6 +500,7 @@ class phoneAccount extends plugin } foreach($query_a as $qry){ + @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$qry, "Database query"); if(!mysql_query($qry,$old_connection)){ echo mysql_error($old_connection); } @@ -514,7 +520,9 @@ class phoneAccount extends plugin /* Check if there is already an entry in sip_users for this uid */ $SQL_query_array = array(); - $rid = mysql_query("SELECT * FROM ".$a_New['SIP_TABLE']." WHERE name='".$this->uid."';\n",$new_connection); + $query = "SELECT * FROM ".$a_New['SIP_TABLE']." WHERE name='".$this->uid."';\n"; + $rid = mysql_query($query,$new_connection); + @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query"); if(mysql_affected_rows($new_connection)){ /********************** @@ -621,7 +629,9 @@ class phoneAccount extends plugin } /* Check if there is already an entry in sip_users for this uid */ - $rid = mysql_query("SELECT * FROM ".$a_New['VOICE_TABLE']." WHERE customer_id='".$customer_id."';\n",$new_connection); + $query_tmp = "SELECT * FROM ".$a_New['VOICE_TABLE']." WHERE customer_id='".$customer_id."';\n"; + $rid = mysql_query($query_tmp,$new_connection); + @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query_tmp, "Database query"); if(mysql_affected_rows($new_connection)){ /********************** @@ -683,6 +693,7 @@ class phoneAccount extends plugin $query[]= "DELETE FROM ".$a_New['EXT_TABLE']." WHERE exten=\"".$s_telenums."\";"; } foreach($query as $qry){ + @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$qry, "Database query"); if(!mysql_query($qry,$new_connection)){ echo mysql_error($new_connection); } @@ -768,6 +779,7 @@ class phoneAccount extends plugin // Perform queries ... if($this->goFonHardware != "automatic"){ foreach($SQL_query_array as $query){ + @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query"); if(!@mysql_query($query,$new_connection)){ print_red(_("Error while performing query:")." ".mysql_error()); return false; @@ -1341,6 +1353,7 @@ class phoneAccount extends plugin $SQL[] = "DELETE FROM ".$a_SETUP['SIP_TABLE']." WHERE name='".$this->uid."';\n"; foreach($SQL as $query){ + @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query"); if(!@mysql_query($query,$r_con)){ print_red(_("Stop".mysql_error())); return false; -- 2.30.2