From 400d23d1b39041b9eb5409ba10d39e5d34fe8e97 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 23 May 2007 08:38:06 +0000 Subject: [PATCH] Updated logging git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6451 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../blocklists/class_blocklistManagement.inc | 2 -- plugins/gofax/faxaccount/main.inc | 1 - .../class_phoneConferenceGeneric.inc | 18 ++++++++++-------- .../class_phoneConferenceManagment.inc | 4 ---- plugins/gofon/macro/class_gofonMacro.inc | 9 ++++----- .../gofon/macro/class_gofonMacroManagement.inc | 5 +---- .../gofon/phoneaccount/class_phoneAccount.inc | 16 ++++++++-------- plugins/gofon/phoneaccount/main.inc | 1 - 8 files changed, 23 insertions(+), 33 deletions(-) diff --git a/plugins/gofax/blocklists/class_blocklistManagement.inc b/plugins/gofax/blocklists/class_blocklistManagement.inc index 7fd5512c7..8c9fde577 100644 --- a/plugins/gofax/blocklists/class_blocklistManagement.inc +++ b/plugins/gofax/blocklists/class_blocklistManagement.inc @@ -252,7 +252,6 @@ class blocklist extends plugin if (isset($_POST['delete_blocklist_confirm'])){ if ($this->acl_is_removeable()){ $this->remove_from_parent(); - gosa_log ("Blocklist object'".$this->dn."' has been removed"); $this->reload (); } else { print_red (_("You have no permission to remove this blocklist.")); @@ -303,7 +302,6 @@ class blocklist extends plugin } $this->save (); - gosa_log ("Blocklist object'".$this->dn."' has been saved"); if (!isset($_POST['edit_apply'])){ $this->dn= ""; diff --git a/plugins/gofax/faxaccount/main.inc b/plugins/gofax/faxaccount/main.inc index 0f1817415..d2786d889 100644 --- a/plugins/gofax/faxaccount/main.inc +++ b/plugins/gofax/faxaccount/main.inc @@ -55,7 +55,6 @@ if (!$remove_lock){ /* No errors, save object */ if (count ($message) == 0){ $gofaxAccount->save (); - gosa_log ("User/fax object'".$ui->dn."' has been saved"); del_lock ($ui->dn); sess_del ('edit'); diff --git a/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/plugins/gofon/conference/class_phoneConferenceGeneric.inc index 50795e6a0..41e574419 100644 --- a/plugins/gofon/conference/class_phoneConferenceGeneric.inc +++ b/plugins/gofon/conference/class_phoneConferenceGeneric.inc @@ -315,13 +315,14 @@ class conference extends plugin $cfg_Current = $this->goFonHomeServers[$this->goFonHomeServer]; $r_current = @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']); if(!$r_current){ - gosa_log(@mysql_error($r_current)); + @log::log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_current)); + return(sprintf(_("The MySQL home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."), $cfg_Current['SERVER'],$cfg_Current['LOGIN'])); } $db_current = @mysql_select_db($cfg_Current['DB'],$r_current); if(!$db_current){ - gosa_log(@mysql_error($r_current)); + @log::log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_current)); mysql_close($r_current); return( sprintf(_("Can't select database '%s' on home server '%s'."),$cfg_Current['DB'],$cfg_Current['SERVER'])); } @@ -334,13 +335,14 @@ class conference extends plugin $cfg_Init = $this->goFonHomeServers[$this->init_HomeServer] ; $r_init = @mysql_pconnect($cfg_Init['SERVER'],$cfg_Init['LOGIN'],$cfg_Init['PASSWORD']); if(!$r_init){ - gosa_log(@mysql_error($r_init)); + @log::log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init)); + return(sprintf(_("The MySQL initial home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."), $cfg_Init['SERVER'],$cfg_Init['LOGIN'])); } $db_init = @mysql_select_db($cfg_Init['DB'],$r_init); if(!$db_init){ - gosa_log(@mysql_error($r_init)); + @log::log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init)); mysql_close($r_init); return( sprintf(_("Can't select database '%s' on initial home server '%s'."),$cfg_Init['DB'],$cfg_Init['SERVER'])); } @@ -429,7 +431,7 @@ class conference extends plugin $query = "SELECT id FROM ".$cfg_Current['EXT_TABLE']." WHERE exten='".$this->telephoneNumber."' OR '".$this->cn."';"; $res = @mysql_query($query,$res_cur); if(!$res){ - gosa_log(@mysql_error($res_cur)); + @log::log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($res_cur)); return(_("Can not check if there are already some entries with given telephone number and/or cn in the destination home server."). " "._("Please have a look a the gosa logfiles.")); } @@ -441,7 +443,7 @@ class conference extends plugin /* Query and ensure that everything went fine */ $res = @mysql_query($SQL,$res_cur); if(!$res){ - gosa_log(@mysql_error($res_cur)); + @log::log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($res_cur)); return(_("Can not remove entries with some telephone number and/or cn from destination home server."). " "._("Please have a look a the gosa logfiles.")); } @@ -559,7 +561,7 @@ class conference extends plugin $query = "SELECT id FROM ".$cfg_Init['EXT_TABLE']." WHERE exten='".$this->old_tele_number."' OR '".$this->old_cn."';"; $res = @mysql_query($query,$r_init); if(!$res){ - gosa_log(@mysql_error($r_init)); + @log::log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init)); return(_("Can not check if entry exists in old database. Please have a look a the gosa logfiles.")); } @@ -572,7 +574,7 @@ class conference extends plugin /* Query and ensure that everything went fine */ $res = @mysql_query($SQL,$r_init); if(!$res){ - gosa_log(@mysql_error($r_init)); + @log::log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init)); return(_("Can not remove old entries from initial home server. Please have a look a the gosa logfiles.")); } diff --git a/plugins/gofon/conference/class_phoneConferenceManagment.inc b/plugins/gofon/conference/class_phoneConferenceManagment.inc index 039399748..715e5fe4a 100644 --- a/plugins/gofon/conference/class_phoneConferenceManagment.inc +++ b/plugins/gofon/conference/class_phoneConferenceManagment.inc @@ -160,7 +160,6 @@ class phoneConferenceManagment extends plugin $acl = $this->ui->get_permissions($this->dn,"gofonconference/conference"); if(preg_match("/d/",$acl)){ $this->remove_from_parent(); - gosa_log ("Department object'".$this->dn."' has been removed"); } else { print_red (_("You have no permission to remove this department.")); } @@ -223,7 +222,6 @@ class phoneConferenceManagment extends plugin $acl = $this->ui->get_permissions($this->dn,"gofonconference/conference"); if(preg_match("/d/",$acl)){ $this->remove_from_parent(); - gosa_log ("Department object'".$this->dn."' has been removed"); } else { print_red (_("You have no permission to remove this department.")); } @@ -287,10 +285,8 @@ class phoneConferenceManagment extends plugin if (count($message) == 0){ if($this->conftab->save() == 1){ - gosa_log ("goFonConference object '".$this->dn."' saving failed."); return; } - gosa_log ("goFonConference object '".$this->dn."' has been saved"); if (!isset($_POST['edit_apply'])){ if ($this->dn != "new"){ diff --git a/plugins/gofon/macro/class_gofonMacro.inc b/plugins/gofon/macro/class_gofonMacro.inc index 213cf6256..3163ec45a 100755 --- a/plugins/gofon/macro/class_gofonMacro.inc +++ b/plugins/gofon/macro/class_gofonMacro.inc @@ -200,13 +200,13 @@ class macro extends plugin foreach($this->goFonHomeServers as $goFonHomeServer => $cfg_Current){ $r_current = @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']); if(!$r_current){ - gosa_log(@mysql_error($r_current)); + @log::log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_current)); return(sprintf(_("The MySQL home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."), $cfg_Current['SERVER'],$cfg_Current['LOGIN'])); } $db_current = @mysql_select_db($cfg_Current['DB'],$r_current); if(!$db_current){ - gosa_log(@mysql_error($r_current)); + @log::log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_current)); mysql_close($r_current); return( sprintf(_("Can't select database '%s' on home server '%s'."),$cfg_Current['DB'],$cfg_Current['SERVER'])); } @@ -237,7 +237,7 @@ class macro extends plugin $db_current = @mysql_select_db($Server['DB'],$r_current); $res = @mysql_query($query,$r_current); if(!$res){ - gosa_log(@mysql_error($r_current)); + @log::log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_current)); return(sprintf(_("Removing macro from '%s' failed. Check GOsa log for mysql error."),$Server['SERVER'])); } @mysql_close($r_current); @@ -345,8 +345,7 @@ class macro extends plugin $query = preg_replace("/%TABLENAME%/",$cfg['EXT_TABLE'],$sql); $res = @mysql_query($query,$r_con); if(!$res){ - gosa_log(@mysql_error($r_con)); - gosa_log($query); + @log::log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_con)); return(sprintf(_("Insert of new macro failed for server '%s'."),$cfg['SERVER'])); } @mysql_close($r_con); diff --git a/plugins/gofon/macro/class_gofonMacroManagement.inc b/plugins/gofon/macro/class_gofonMacroManagement.inc index 8069d41cd..8312702cb 100755 --- a/plugins/gofon/macro/class_gofonMacroManagement.inc +++ b/plugins/gofon/macro/class_gofonMacroManagement.inc @@ -133,7 +133,6 @@ class gofonMacro extends plugin /* Save data data to ldap */ $this->macrotabs->save(); - gosa_log ("Macro object'".$this->dn."' has been saved"); if (!isset($_POST['edit_apply'])){ /* macro has been saved successfully, remove lock from @@ -232,7 +231,6 @@ class gofonMacro extends plugin /* Delete request is permitted, perform LDAP action */ $this->macrotabs= new macrotabs($this->config,$this->config->data['TABS']['MACROTABS'], $dn,"gofonmacro"); $this->macrotabs->delete (); - gosa_log ("macro object'".$dn."' has been removed"); unset ($this->macrotabs); $this->macrotabs= NULL; @@ -310,14 +308,13 @@ class gofonMacro extends plugin /* Delete request is permitted, perform LDAP action */ $this->macrotabs= new macrotabs($this->config,$this->config->data['TABS']['MACROTABS'], $this->dn,"gofonmacro"); $this->macrotabs->delete (); - gosa_log ("macro object'".$this->dn."' has been removed"); unset ($this->macrotabs); $this->macrotabs= NULL; } else { /* Normally this shouldn't be reached, send some extra logs to notify the administrator */ print_red (_("You are not allowed to delete this macro!")); - gosa_log ("Warning: '".$this->ui->uid."' tried to trick group deletion."); + @log::log("security","gofonmacro/".get_class($this),$this->dn,array(),"Tried to trick deletion."); } /* Remove lock file after successfull deletion */ del_lock ($this->dn); diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc index 25e1f2382..61ae399ed 100644 --- a/plugins/gofon/phoneaccount/class_phoneAccount.inc +++ b/plugins/gofon/phoneaccount/class_phoneAccount.inc @@ -119,12 +119,12 @@ class phoneAccount extends plugin if(!$r_con){ print_red( sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."), $cur_cfg['SERVER'],$cur_cfg['LOGIN'])); - gosa_log(mysql_error()); + @log::log("debug","gofonreport/".get_class($this),"",array(),@mysql_error()); } $db = @mysql_select_db($cur_cfg['DB'],$r_con); if(!$db){ print_red(sprintf(_("Can't select database %s on %s."),$cur_cfg['DB'],$cur_cfg['SERVER'])); - gosa_log(mysql_error()); + @log::log("debug","gofonreport/".get_class($this),"",array(),@mysql_error()); } $first = false; @@ -436,7 +436,7 @@ class phoneAccount extends plugin $this->generate_error = sprintf( _("The MySQL Server '%s' isn't reachable as user '%s'. Abort saving entries to keep the database consistent, check GOsa log for mysql error."), $a_New['SERVER'],$a_New['LOGIN']); - gosa_log(@mysql_error($new_connection)); + @log::log("debug","gofonreport/".get_class($this),"",array(),@mysql_error($new_connection)); return false; } $new_database = @mysql_select_db($a_New['DB'],$new_connection); @@ -444,7 +444,7 @@ class phoneAccount extends plugin $this->generate_error = sprintf( _("Can't select database %s on %s. Abort saving entries to keep the database consistent, check GOsa log for mysql error."), $a_New['DB'],$a_New['SERVER']); - gosa_log( @mysql_error($new_connection)); + @log::log("debug","gofonreport/".get_class($this),"",array(),@mysql_error($new_connection)); return false; } @@ -463,7 +463,7 @@ class phoneAccount extends plugin $this->generate_error = sprintf( _("The old MySQL home server '%s' isn't reachable as user '%s'. Abort saving entries to keep the database consistent, check GOsa log for mysql error."), $a_Remove['SERVER'],$a_Remove['LOGIN']); - gosa_log(@mysql_error($old_connection)); + @log::log("debug","gofonreport/".get_class($this),"",array(),@mysql_error($old_connection)); return false; } $old_database = @mysql_select_db($a_Remove['DB'],$old_connection); @@ -471,7 +471,7 @@ class phoneAccount extends plugin $this->generate_error = sprintf( _("Can't select database %s on %s. Abort saving entries to keep the database consistent, check GOsa log for mysql error."), $a_Remove['DB'],$a_Remove['SERVER']); - gosa_log(@mysql_error($old_connection)); + @log::log("debug","gofonreport/".get_class($this),"",array(),@mysql_error($old_connection)); return false; } } @@ -1295,7 +1295,7 @@ class phoneAccount extends plugin if(!$r_con){ print_red(sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."), $a_SETUP['SERVER'],$a_SETUP['LOGIN'])); - gosa_log(@mysql_error()); + @log::log("debug","gofonreport/".get_class($this),"",array(),@mysql_error()); return false; } @@ -1305,7 +1305,7 @@ class phoneAccount extends plugin // Test if we have the database selected correctly if(!$db){ print_red(sprintf(_("Can't select database %s on %s."),$a_SETUP['DB'],$a_SETUP['SERVER'])); - gosa_log(@mysql_error()); + @log::log("debug","gofonreport/".get_class($this),"",array(),@mysql_error()); return false; } diff --git a/plugins/gofon/phoneaccount/main.inc b/plugins/gofon/phoneaccount/main.inc index 5b113a8fe..683057ad2 100644 --- a/plugins/gofon/phoneaccount/main.inc +++ b/plugins/gofon/phoneaccount/main.inc @@ -72,7 +72,6 @@ if (!$remove_lock){ if (count ($message) == 0){ $phoneAccount->save (); - gosa_log ("User/phone object'".$ui->dn."' has been saved"); del_lock ($ui->dn); sess_del ('edit'); -- 2.30.2