From 4877e2474cba12899bb23ba720eefeffb8f98e8e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Dec 2011 11:57:09 +0100 Subject: [PATCH] Qual: Uniformize code --- htdocs/core/db/mssql.class.php | 14 +++++++------- htdocs/core/db/mysql.class.php | 28 ++++++++++++++-------------- htdocs/core/db/mysqli.class.php | 28 ++++++++++++++-------------- htdocs/core/db/pgsql.class.php | 14 +++++++------- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index b845e54cd93..5056bf65441 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -92,7 +92,7 @@ class DoliDBMssql $this->connected = 0; $this->ok = 0; $this->error="Mssql PHP functions for using MSSql driver are not available in this version of PHP"; - dol_syslog("DoliDB::DoliDB : MSsql PHP functions for using MSsql driver are not available in this version of PHP",LOG_ERR); + dol_syslog(get_class($this)."::DoliDBMssql : MSsql PHP functions for using MSsql driver are not available in this version of PHP",LOG_ERR); return $this->ok; } @@ -101,7 +101,7 @@ class DoliDBMssql $this->connected = 0; $this->ok = 0; $this->error=$langs->trans("ErrorWrongHostParameter"); - dol_syslog("DoliDB::DoliDB : Erreur Connect, wrong host parameters",LOG_ERR); + dol_syslog(get_class($this)."::DoliDBMssql : Erreur Connect, wrong host parameters",LOG_ERR); return $this->ok; } @@ -120,7 +120,7 @@ class DoliDBMssql $this->connected = 0; $this->ok = 0; $this->error=mssql_get_last_message(); - dol_syslog("DoliDB::DoliDB : Erreur Connect mssql_get_last_message=".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::DoliDBMssql : Erreur Connect mssql_get_last_message=".$this->error,LOG_ERR); } // Si connexion serveur ok et si connexion base demandee, on essaie connexion base @@ -138,7 +138,7 @@ class DoliDBMssql $this->database_name = ''; $this->ok = 0; $this->error=$this->error(); - dol_syslog("DoliDB::DoliDB : Erreur Select_db ".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::DoliDBMssql : Erreur Select_db ".$this->error,LOG_ERR); } } else @@ -186,7 +186,7 @@ class DoliDBMssql */ function connect($host, $login, $passwd, $name, $port=0) { - dol_syslog("DoliDB::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name"); + dol_syslog(get_class($this)."::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name"); $newhost=$host; if ($port) $newhost.=':'.$port; $this->db = @mssql_connect($newhost, $login, $passwd); @@ -242,7 +242,7 @@ class DoliDBMssql { if ($this->db) { - //dol_syslog("DoliDB::disconnect",LOG_DEBUG); + //dol_syslog(get_class($this)."::disconnect",LOG_DEBUG); $this->connected=0; return mssql_close($this->db); } @@ -403,7 +403,7 @@ class DoliDBMssql $this->lastqueryerror = $query; $this->lasterror = $this->error(); $this->lasterrno = $row["code"]; - dol_syslog("Mssql.lib::query SQL error: ".$query, LOG_WARNING); + dol_syslog(get_class($this)."::query SQL error: ".$query, LOG_WARNING); } $this->lastquery=$query; $this->results = $ret; diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index a76db78f8cd..3cd4f17eb7c 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -98,7 +98,7 @@ class DoliDBMysql $this->connected = 0; $this->ok = 0; $this->error="Mysql PHP functions for using MySql driver are not available in this version of PHP. Try to use another driver."; - dol_syslog("DoliDB::DoliDB : Mysql PHP functions for using Mysql driver are not available in this version of PHP. Try to use another driver.",LOG_ERR); + dol_syslog(get_class($this)."::DoliDBMysql : Mysql PHP functions for using Mysql driver are not available in this version of PHP. Try to use another driver.",LOG_ERR); return $this->ok; } @@ -107,7 +107,7 @@ class DoliDBMysql $this->connected = 0; $this->ok = 0; $this->error=$langs->trans("ErrorWrongHostParameter"); - dol_syslog("DoliDB::DoliDB : Erreur Connect, wrong host parameters",LOG_ERR); + dol_syslog(get_class($this)."::DoliDBMysql : Erreur Connect, wrong host parameters",LOG_ERR); return $this->ok; } @@ -124,7 +124,7 @@ class DoliDBMysql $this->connected = 0; $this->ok = 0; $this->error=mysql_error(); - dol_syslog("DoliDB::DoliDB : Erreur Connect mysql_error=".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::DoliDBMysql : Erreur Connect mysql_error=".$this->error,LOG_ERR); } // Si connexion serveur ok et si connexion base demandee, on essaie connexion base @@ -152,7 +152,7 @@ class DoliDBMysql $this->database_name = ''; $this->ok = 0; $this->error=$this->error(); - dol_syslog("DoliDB::DoliDB : Erreur Select_db ".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::DoliDBMysql : Erreur Select_db ".$this->error,LOG_ERR); } } else @@ -198,7 +198,7 @@ class DoliDBMysql */ function select_db($database) { - dol_syslog("DoliDB::select_db database=".$database, LOG_DEBUG); + dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG); return mysql_select_db($database, $this->db); } @@ -215,7 +215,7 @@ class DoliDBMysql */ function connect($host, $login, $passwd, $name, $port=0) { - dol_syslog("DoliDB::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name",LOG_DEBUG); + dol_syslog(get_class($this)."::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name",LOG_DEBUG); $newhost=$host; @@ -269,7 +269,7 @@ class DoliDBMysql { if ($this->db) { - //dol_syslog("DoliDB::disconnect",LOG_DEBUG); + //dol_syslog(get_class($this)."::disconnect",LOG_DEBUG); $this->connected=0; return mysql_close($this->db); } @@ -380,7 +380,7 @@ class DoliDBMysql $this->lastqueryerror = $query; $this->lasterror = $this->error(); $this->lasterrno = $this->errno(); - dol_syslog("Mysql.lib::query SQL error: ".$query." ".$this->lasterrno, LOG_WARNING); + dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno, LOG_WARNING); } $this->lastquery=$query; $this->results = $ret; @@ -1032,11 +1032,11 @@ class DoliDBMysql $sql.= " VALUES ('".addslashes($dolibarr_main_db_host)."','".addslashes($dolibarr_main_db_user)."',password('".addslashes($dolibarr_main_db_pass)."')"; $sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y','Y')"; - dol_syslog("mysql.lib::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log + dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log $resql=$this->query($sql); if (! $resql) { - dol_syslog("mysqli.lib::DDLCreateUser sql=".$sql, LOG_ERR); + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); return -1; } @@ -1045,21 +1045,21 @@ class DoliDBMysql $sql.= " VALUES ('".addslashes($dolibarr_main_db_host)."','".addslashes($dolibarr_main_db_name)."','".addslashes($dolibarr_main_db_user)."'"; $sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y','Y')"; - dol_syslog("mysql.lib::DDLCreateUser sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql,LOG_DEBUG); $resql=$this->query($sql); if (! $resql) { - dol_syslog("mysqli.lib::DDLCreateUser sql=".$sql, LOG_ERR); + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); return -1; } $sql="FLUSH Privileges"; - dol_syslog("mysql.lib::DDLCreateUser sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql,LOG_DEBUG); $resql=$this->query($sql); if (! $resql) { - dol_syslog("mysqli.lib::DDLCreateUser sql=".$sql, LOG_ERR); + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); return -1; } diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 1f48b583386..19b2b8fe885 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -98,7 +98,7 @@ class DoliDBMysqli $this->connected = 0; $this->ok = 0; $this->error="Mysqli PHP functions for using Mysqli driver are not available in this version of PHP. Try to use another driver."; - dol_syslog("DoliDB::DoliDB : Mysqli PHP functions for using Mysqli driver are not available in this version of PHP. Try to use another driver.",LOG_ERR); + dol_syslog(get_class($this)."::DoliDBMysqli : Mysqli PHP functions for using Mysqli driver are not available in this version of PHP. Try to use another driver.",LOG_ERR); return $this->ok; } @@ -107,7 +107,7 @@ class DoliDBMysqli $this->connected = 0; $this->ok = 0; $this->error=$langs->trans("ErrorWrongHostParameter"); - dol_syslog("DoliDB::DoliDB : Erreur Connect, wrong host parameters",LOG_ERR); + dol_syslog(get_class($this)."::DoliDBMysqli : Erreur Connect, wrong host parameters",LOG_ERR); return $this->ok; } @@ -126,7 +126,7 @@ class DoliDBMysqli $this->connected = 0; $this->ok = 0; $this->error=mysqli_connect_error(); - dol_syslog("DoliDB::DoliDB : Erreur Connect mysqli_connect_error=".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::DoliDBMysqli : Erreur Connect mysqli_connect_error=".$this->error,LOG_ERR); } // Si connexion serveur ok et si connexion base demandee, on essaie connexion base @@ -154,7 +154,7 @@ class DoliDBMysqli $this->database_name = ''; $this->ok = 0; $this->error=$this->error(); - dol_syslog("DoliDB::DoliDB : Erreur Select_db ".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::DoliDBMysqli : Erreur Select_db ".$this->error,LOG_ERR); } } else @@ -200,7 +200,7 @@ class DoliDBMysqli */ function select_db($database) { - dol_syslog("DoliDB::select_db database=".$database, LOG_DEBUG); + dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG); return mysqli_select_db($this->db,$database); } @@ -218,7 +218,7 @@ class DoliDBMysqli */ function connect($host, $login, $passwd, $name, $port=0) { - dol_syslog("DoliDB::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name",LOG_DEBUG); + dol_syslog(get_class($this)."::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name",LOG_DEBUG); $newhost=$host; $newport=$port; @@ -276,7 +276,7 @@ class DoliDBMysqli { if ($this->db) { - //dol_syslog("DoliDB::disconnect",LOG_DEBUG); + //dol_syslog(get_class($this)."::disconnect",LOG_DEBUG); $this->connected=0; return mysqli_close($this->db); } @@ -385,7 +385,7 @@ class DoliDBMysqli $this->lastqueryerror = $query; $this->lasterror = $this->error(); $this->lasterrno = $this->errno(); - dol_syslog("Mysqli.lib::query SQL error: ".$query." ".$this->lasterrno, LOG_WARNING); + dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno, LOG_WARNING); } $this->lastquery=$query; $this->results = $ret; @@ -1044,11 +1044,11 @@ class DoliDBMysqli $sql.= " VALUES ('".addslashes($dolibarr_main_db_host)."','".addslashes($dolibarr_main_db_user)."',password('".addslashes($dolibarr_main_db_pass)."')"; $sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y','Y')"; - dol_syslog("mysqli.lib::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log + dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log $resql=$this->query($sql); if (! $resql) { - dol_syslog("mysqli.lib::DDLCreateUser sql=".$sql, LOG_ERR); + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); return -1; } @@ -1057,21 +1057,21 @@ class DoliDBMysqli $sql.= " VALUES ('".addslashes($dolibarr_main_db_host)."','".addslashes($dolibarr_main_db_name)."','".addslashes($dolibarr_main_db_user)."'"; $sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y','Y')"; - dol_syslog("mysqli.lib::DDLCreateUser sql=".$sql); + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql); $resql=$this->query($sql); if (! $resql) { - dol_syslog("mysqli.lib::DDLCreateUser sql=".$sql, LOG_ERR); + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); return -1; } $sql="FLUSH Privileges"; - dol_syslog("mysqli.lib::DDLCreateUser sql=".$sql); + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql); $resql=$this->query($sql); if (! $resql) { - dol_syslog("mysqli.lib::DDLCreateUser sql=".$sql, LOG_ERR); + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR); return -1; } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 333a60783a0..a2b600908c2 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -87,7 +87,7 @@ class DoliDBPgsql $this->connected = 0; $this->ok = 0; $this->error="Pgsql PHP functions are not available in this version of PHP"; - dol_syslog("DoliDB::DoliDB : Pgsql PHP functions are not available in this version of PHP",LOG_ERR); + dol_syslog(get_class($this)."::DoliDBPgsql : Pgsql PHP functions are not available in this version of PHP",LOG_ERR); return $this->ok; } @@ -96,7 +96,7 @@ class DoliDBPgsql $this->connected = 0; $this->ok = 0; $this->error=$langs->trans("ErrorWrongHostParameter"); - dol_syslog("DoliDB::DoliDB : Erreur Connect, wrong host parameters",LOG_ERR); + dol_syslog(get_class($this)."::DoliDBPgsql : Erreur Connect, wrong host parameters",LOG_ERR); return $this->ok; } @@ -114,7 +114,7 @@ class DoliDBPgsql $this->connected = 0; $this->ok = 0; $this->error='Host, login or password incorrect'; - dol_syslog("DoliDB::DoliDB : Erreur Connect ".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::DoliDBPgsql : Erreur Connect ".$this->error,LOG_ERR); } // Si connexion serveur ok et si connexion base demandee, on essaie connexion base @@ -132,7 +132,7 @@ class DoliDBPgsql $this->database_name = ''; $this->ok = 0; $this->error=$this->error(); - dol_syslog("DoliDB::DoliDB : Erreur Select_db ".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::DoliDBPgsql : Erreur Select_db ".$this->error,LOG_ERR); } } else @@ -412,7 +412,7 @@ class DoliDBPgsql { if ($this->db) { - //dol_syslog("DoliDB::disconnect",LOG_DEBUG); + //dol_syslog(get_class($this)."::disconnect",LOG_DEBUG); $this->connected=0; return pg_close($this->db); } @@ -531,7 +531,7 @@ class DoliDBPgsql $this->lastqueryerror = $query; $this->lasterror = $this->error(); $this->lasterrno = $this->errno(); - dol_syslog("Pgsql.lib::query SQL error: ".$query." ".$this->lasterrno, LOG_WARNING); + dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno, LOG_WARNING); //print "\n>> ".$query."
\n"; //print '>> '.$this->lasterrno.' - '.$this->lasterror.' - '.$this->lastqueryerror."
\n"; @@ -1078,7 +1078,7 @@ class DoliDBPgsql { $sql = "create user \"".addslashes($dolibarr_main_db_user)."\" with password '".addslashes($dolibarr_main_db_pass)."'"; - dol_syslog("pgsql.lib::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log + dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log $resql=$this->query($sql); if (! $resql) {