From e253202995d188925fa4e9df4f6dea0523511eae Mon Sep 17 00:00:00 2001
From: oilyflutesalad <oilyflutesalad@ispconfig3>
Date: Mon, 18 Jan 2010 05:56:48 -0500
Subject: [PATCH] Fixed: FS#928 - System Load Averages should no longer show as zero on non-english linux distros
---
server/lib/classes/db_mysql.inc.php | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php
index 828bb43..1a3b978 100644
--- a/server/lib/classes/db_mysql.inc.php
+++ b/server/lib/classes/db_mysql.inc.php
@@ -41,7 +41,7 @@
var $errorNumber = 0; // last error number
var $errorMessage = ""; // last error message
var $errorLocation = "";// last error location
- var $show_error_messages = false;
+ var $show_error_messages = true;
// constructor
function db()
@@ -58,13 +58,15 @@
// error handler
function updateError($location)
{
- $this->errorNumber = mysql_errno();
- $this->errorMessage = mysql_error();
+ global $app;
+ $this->errorNumber = mysql_errno($this->linkId);
+ $this->errorMessage = mysql_error($this->linkId);
$this->errorLocation = $location;
- if($this->errorNumber && $this->show_error_messages)
+ if($this->errorNumber && $this->show_error_messages && method_exists($app,'log'))
{
- echo('<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage);
- flush();
+ // echo('<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage);
+ $app->log($this->errorLocation." ".$this->errorMessage,LOGLEVEL_WARN);
+ //flush();
}
}
@@ -75,7 +77,7 @@
$this->linkId = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass);
if(!$this->linkId)
{
- $this->updateError('DB::connect()<br />mysql_connect');
+ $this->updateError('DB::connect()-> mysql_connect');
return false;
}
}
@@ -90,11 +92,11 @@
}
if(!mysql_select_db($this->dbName, $this->linkId))
{
- $this->updateError('DB::connect()<br />mysql_select_db');
+ $this->updateError('DB::connect()-> mysql_select_db');
return false;
}
$this->queryId = @mysql_query($queryString, $this->linkId);
- $this->updateError('DB::query('.$queryString.')<br />mysql_query');
+ $this->updateError('DB::query('.$queryString.') -> mysql_query');
if(!$this->queryId)
{
return false;
@@ -132,7 +134,7 @@
function nextRecord()
{
$this->record = mysql_fetch_assoc($this->queryId);
- $this->updateError('DB::nextRecord()<br />mysql_fetch_array');
+ $this->updateError('DB::nextRecord()-> mysql_fetch_array');
if(!$this->record || !is_array($this->record))
{
return false;
@@ -187,7 +189,8 @@
return $out;
}
-
+ /*
+ //* These functions are deprecated and will be removed.
function insert($tablename,$form,$debug = 0)
{
if(is_array($form)){
@@ -222,6 +225,7 @@
if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
}
}
+ */
public function closeConn()
{
--
Gitblit v1.9.1