[Secureideas-cvs] base-php4/includes base_db.inc.php,1.44,1.45
Brought to you by:
secureideas,
sinukas
From: Juergen L. <jle...@us...> - 2009-09-05 20:55:01
|
Update of /cvsroot/secureideas/base-php4/includes In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1298/base-php4/includes Modified Files: base_db.inc.php Log Message: I have fixed one bug out of possibly several bugs in the complex of archiving alerts. This particular bug here was reported at https://sourceforge.net/forum/message.php?msg_id=7609952 The alerts are being archived correctly. This can be proved by a manual SQL query. baseDBConnect() connects with the correct database, i.e. the archive database. But the alerts are being displayed as if it had connected with the alert database. And why is this now a problem, and why was this not a problem in the past? Presumably because of a stricter behaviour in newer versions of php or adodb: In all of the previous versions of BASE the baseDBConnect() function has used ONLY the baseConnect() method for archive lookups and NOT the basePConnect() method. baseConnect() lets only the first SQL query be executed correctly, but none of any subsequent ones. So the subsequent queries actually targeted the database from the still persisting connection. Which is the alert database, and not the actually correct archive database. Index: base_db.inc.php =================================================================== RCS file: /cvsroot/secureideas/base-php4/includes/base_db.inc.php,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- base_db.inc.php 18 Dec 2008 02:13:01 -0000 1.44 +++ base_db.inc.php 5 Sep 2009 20:54:49 -0000 1.45 @@ -42,17 +42,30 @@ function baseDBConnect($method, $database, $host, $port, $username, $password, $force = 0) { - GLOBAL $archive_dbname, $archive_host, $archive_port, $archive_user, $archive_password; + GLOBAL $archive_dbname, $archive_host, $archive_port, $archive_user, $archive_password, $debug_mode; // Check archive cookie to see if they want to be using the archive tables // and check - do we force to use specified database even if archive cookie is set if ( (@$_COOKIE['archive'] == 1) && ($force != 1) ) { // Connect to the archive tables + if ($debug_mode > 0) + { + print "<BR><BR>\n" . __FILE__ . ":" . __LINE__ . ": DEBUG: Connecting to archive db.<BR><BR>\n\n"; + } + + if ( $method == DB_CONNECT ) $this->baseConnect($archive_dbname, $archive_host, $archive_port, $archive_user, $archive_password); + else + $this->basePConnect($archive_dbname, $archive_host, $archive_port, $archive_user, $archive_password); } else { // Connect to the main alert tables + if ($debug_mode > 0) + { + print "<BR><BR>\n" . __FILE__ . ":" . __LINE__ . ": DEBUG: Connecting to alert db.<BR><BR>\n\n"; + } + if ( $method == DB_CONNECT ) $this->baseConnect($database, $host, $port, $username, $password); else @@ -474,6 +487,9 @@ function baseFetchRow() { + GLOBAL $debug_mode; + + /* Workaround for the problem, that the database may contain NULL * whereas "NOT NULL" has been defined, when it was created */ if (!is_object($this->row)) |