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


Ignore:
Timestamp:
Aug 27, 2015 2:35:55 AM (9 years ago)
Author:
anonymous
Message:

Detecting CLI also using php_sapi_name()

File:
1 edited

Legend:

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

    r532 r546  
    227227    {
    228228        if ($this->getParam('db_die_on_failure')) {
    229             if (!defined('_CLI')) {
     229            if (!defined('_CLI') && 'cli' !== php_sapi_name()) {
    230230                // For http requests, send a Service Unavailable header.
    231231                header(' ', true, 503);
     
    312312        // http://dev.mysql.com/doc/refman/5.0/en/gone-away.html
    313313        if (!mysql_ping($this->dbh)) {
    314             $app->logMsg(sprintf('MySQL ping failed; reconnecting
 ("%s")', truncate(trim($debugqry), 150)), LOG_NOTICE, __FILE__, __LINE__);
     314            $app->logMsg(sprintf('MySQL ping failed; reconnecting
 ("%s")', truncate(trim($debugqry), 150)), LOG_DEBUG, __FILE__, __LINE__);
    315315            $this->reconnect();
    316316        }
     
    323323            $app->logMsg(sprintf('MySQL error %s: %s in query: %s', mysql_errno($this->dbh), mysql_error($this->dbh), $debugqry), LOG_EMERG, __FILE__, __LINE__);
    324324            if ($this->getParam('db_debug')) {
    325                 if (!defined('_CLI')) {
     325                if (!defined('_CLI') && 'cli' !== php_sapi_name()) {
    326326                    echo '<pre style="padding:2em; background:#ddd; font:9px monaco;">' . wordwrap(mysql_error($this->dbh)) . '<hr>' . htmlspecialchars($debugqry) . '</pre>';
    327327                }
Note: See TracChangeset for help on using the changeset viewer.