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


Ignore:
Timestamp:
Aug 27, 2015 3:22:39 AM (9 years ago)
Author:
anonymous
Message:

Moved CLI flag to ->cli which can be forced off for tests

File:
1 edited

Legend:

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

    r546 r547  
    226226    protected function _fail()
    227227    {
     228        $app =& App::getInstance();
     229
    228230        if ($this->getParam('db_die_on_failure')) {
    229             if (!defined('_CLI') && 'cli' !== php_sapi_name()) {
     231            if (!$app->cli) {
    230232                // For http requests, send a Service Unavailable header.
    231233                header(' ', true, 503);
     
    323325            $app->logMsg(sprintf('MySQL error %s: %s in query: %s', mysql_errno($this->dbh), mysql_error($this->dbh), $debugqry), LOG_EMERG, __FILE__, __LINE__);
    324326            if ($this->getParam('db_debug')) {
    325                 if (!defined('_CLI') && 'cli' !== php_sapi_name()) {
     327                if (!$app->cli) {
    326328                    echo '<pre style="padding:2em; background:#ddd; font:9px monaco;">' . wordwrap(mysql_error($this->dbh)) . '<hr>' . htmlspecialchars($debugqry) . '</pre>';
    327329                }
Note: See TracChangeset for help on using the changeset viewer.