Changeset 15 for trunk/lib/DB.inc.php


Ignore:
Timestamp:
Nov 13, 2005 4:51:22 AM (19 years ago)
Author:
scdev
Message:

M trunk/tests/run_tests.sh
Now can run tests without being in tests dir.

M trunk/tests/_config.inc.php
No change

M trunk/tests/Auth_SQLTest.php
...

M trunk/lib/RecordVersion.inc.php
Removed debugging.

M trunk/lib/DB.inc.php
Added die on connect error only if db_die_on_failure is true.

M trunk/lib/DBSessionHandler.inc.php
Added more accurate error-checking.

M trunk/lib/FormValidator.inc.php
Fixed email regex bugs.

M trunk/lib/SpellCheck.inc.php
Integrated lots of bug fixes from UK update.

M trunk/lib/Auth_SQL.inc.php
Lots of minor bug fixes.

M trunk/lib/App.inc.php
A couple minor bug fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/DB.inc.php

    r14 r15  
    77 *
    88 * @author  Quinn Comendant <quinn@strangecode.com>
    9  * @version 1.0
     9 * @version 1.0.1
    1010 */
    1111 
     
    144144        }
    145145       
    146         // Connection errors.
     146        // Test for connection errors.
    147147        if (!$this->dbh || mysql_error($this->dbh)) {
    148148            $mysql_error_msg = $this->dbh ? 'Codebase MySQL error: (' . mysql_errno($this->dbh) . ') ' . mysql_error($this->dbh) : 'Codebase MySQL error: Could not connect to server.';
     149            App::logMsg($mysql_error_msg, LOG_EMERG, __FILE__, __LINE__);
     150
     151            // Print helpful or pretty error?
    149152            if ($this->getParam('db_debug')) {
    150153                echo $mysql_error_msg . "\n";
     
    152155                echo _("This page is temporarily unavailable. It should be back up in a few minutes.");
    153156            }
    154             App::logMsg($mysql_error_msg, LOG_EMERG, __FILE__, __LINE__);
    155             echo "\n\n<!-- Script execution stopped out of embarrassment. -->";
    156             die;
     157
     158            // Die or continue without connection?
     159            if ($this->getParam('db_die_on_failure')) {
     160                echo "\n\n<!-- Script execution stopped out of embarrassment. -->";
     161                die;
     162            } else {
     163                return false;
     164            }
    157165        }
    158166       
Note: See TracChangeset for help on using the changeset viewer.