[pLog-svn] r6451 - plog/trunk/class/database
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Fri May 9 10:38:02 EDT 2008
Author: jondaley
Date: 2008-05-09 10:38:01 -0400 (Fri, 09 May 2008)
New Revision: 6451
Modified:
plog/trunk/class/database/ltdb.class.php
Log:
use output buffering to catch php library errors (we can use this method to catch lots of issues, like plugins/locales/etc that have extra spaces/newlines/etc in them). auto retry for hosts that don't allow non-persistent connections. remove die() since we have exceptions
Modified: plog/trunk/class/database/ltdb.class.php
===================================================================
--- plog/trunk/class/database/ltdb.class.php 2008-05-09 14:12:33 UTC (rev 6450)
+++ plog/trunk/class/database/ltdb.class.php 2008-05-09 14:38:01 UTC (rev 6451)
@@ -76,20 +76,26 @@
$dbcharset = $fileConfig->getValue( "db_character_set", DEFAULT_DATABASE_CHARSET );
$dbpersistent = $fileConfig->getValue( "db_persistent" );
if($dbpersistent == true) {
+ ob_start();
if( !$db->PConnect( $host, $username, $password, $dbname, $dbcharset )) {
- $message = "Fatal error: could not connect to the database!".
- " Error: ".$db->ErrorMsg();
- throw( new Exception( $message ));
- die();
- }
+ // some hosts don't allow persistent connections, just retry
+ // with a regular connect, and avoid an error message
+ if( !$db->Connect( $host, $username, $password, $dbname, $dbcharset )) {
+ $message = "Fatal error: could not connect to the database!".
+ " Error: ".$db->ErrorMsg().ob_get_clean();
+ throw( new Exception( $message ));
+ }
+ }
+ ob_end_flush();
}
else {
+ ob_start();
if( !$db->Connect( $host, $username, $password, $dbname, $dbcharset )) {
$message = "Fatal error: could not connect to the database!".
- " Error: ".$db->ErrorMsg();
+ " Error: ".$db->ErrorMsg().ob_get_clean();
throw( new Exception( $message ));
- die();
}
+ ob_end_flush();
}
// pass the options to the driver, if any
More information about the pLog-svn
mailing list