Changeset 546
- Timestamp:
- Aug 27, 2015 2:35:55 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docs/examples/_config.inc.php
r545 r546 96 96 )); 97 97 98 if (defined('_CLI') ) {98 if (defined('_CLI') || 'cli' === php_sapi_name()) { 99 99 // DB credentials for command line scripts stored in a file with read rights 100 100 // given only to the user who will be executing the scripts: -rw------- -
trunk/lib/App.inc.php
r536 r546 351 351 // DB credentials for CLI scripts stored in a JSON file with read rights given only to the user who will be executing the scripts: -r-------- 352 352 // But not if all DB credentials have been defined already by other means. 353 if ( defined('_CLI') && (!$this->getParam('db_server') || !$this->getParam('db_name') || !$this->getParam('db_user') || !$this->getParam('db_pass'))) {353 if (('cli' === php_sapi_name() || defined('_CLI')) && (!$this->getParam('db_server') || !$this->getParam('db_name') || !$this->getParam('db_user') || !$this->getParam('db_pass'))) { 354 354 if (false !== $db_auth_file = stream_resolve_include_path($this->getParam('db_auth_file'))) { 355 355 if (is_readable($db_auth_file)) { … … 386 386 387 387 // Skip sessions if disabled or automatically skip if run in a CLI script. 388 if (true === $this->getParam('enable_session') && !defined('_CLI') ) {388 if (true === $this->getParam('enable_session') && !defined('_CLI') && 'cli' !== php_sapi_name()) { 389 389 390 390 // Session parameters. … … 450 450 451 451 // Character set. This should also be printed in the html header template. 452 if (!defined('_CLI') ) {452 if (!defined('_CLI') && 'cli' !== php_sapi_name()) { 453 453 if (!headers_sent($h_file, $h_line)) { 454 454 header('Content-type: text/html; charset=' . $this->getParam('character_set')); … … 464 464 $codebase_version = trim(file_get_contents($codebase_version_file)); 465 465 $this->setParam(array('codebase_version' => $codebase_version)); 466 if (!defined('_CLI') ) {466 if (!defined('_CLI') && 'cli' !== php_sapi_name()) { 467 467 if (!headers_sent($h_file, $h_line)) { 468 468 header('X-Codebase-Version: ' . $codebase_version); … … 487 487 $this->setParam(array('site_version' => $site_version)); 488 488 } 489 if (!defined('_CLI') && $this->getParam('site_version')) {489 if (!defined('_CLI') && 'cli' !== php_sapi_name() && $this->getParam('site_version')) { 490 490 if (!headers_sent($h_file, $h_line)) { 491 491 header('X-Site-Version: ' . $site_version); -
trunk/lib/DB.inc.php
r532 r546 227 227 { 228 228 if ($this->getParam('db_die_on_failure')) { 229 if (!defined('_CLI') ) {229 if (!defined('_CLI') && 'cli' !== php_sapi_name()) { 230 230 // For http requests, send a Service Unavailable header. 231 231 header(' ', true, 503); … … 312 312 // http://dev.mysql.com/doc/refman/5.0/en/gone-away.html 313 313 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__); 315 315 $this->reconnect(); 316 316 } … … 323 323 $app->logMsg(sprintf('MySQL error %s: %s in query: %s', mysql_errno($this->dbh), mysql_error($this->dbh), $debugqry), LOG_EMERG, __FILE__, __LINE__); 324 324 if ($this->getParam('db_debug')) { 325 if (!defined('_CLI') ) {325 if (!defined('_CLI') && 'cli' !== php_sapi_name()) { 326 326 echo '<pre style="padding:2em; background:#ddd; font:9px monaco;">' . wordwrap(mysql_error($this->dbh)) . '<hr>' . htmlspecialchars($debugqry) . '</pre>'; 327 327 } -
trunk/lib/Prefs.inc.php
r541 r546 175 175 { 176 176 // CLI scripts can't use prefs stored in HTTP-based protocols. 177 if ( defined('_CLI')177 if ((defined('_CLI') || 'cli' === php_sapi_name()) 178 178 && isset($params['storagetype']) 179 179 && in_array($params['storagetype'], array('cookie', 'session'))) { -
trunk/lib/Utilities.inc.php
r545 r546 37 37 function dump($var, $display=false, $var_dump=false, $file='', $line='') 38 38 { 39 if (defined('_CLI') ) {39 if (defined('_CLI') || 'cli' === php_sapi_name()) { 40 40 echo "DUMP FROM: $file $line\n"; 41 41 } else { … … 60 60 } 61 61 } 62 if (defined('_CLI') ) {62 if (defined('_CLI') || 'cli' === php_sapi_name()) { 63 63 echo "\n"; 64 64 } else {
Note: See TracChangeset
for help on using the changeset viewer.