drupal_is_cli

Versions
7
drupal_is_cli()

Detect whether the current script is running in a command-line environment.

▾ 2 functions call drupal_is_cli()

drupal_page_is_cacheable in includes/bootstrap.inc
Determine the cacheability of the current page.
_drupal_bootstrap_page_header in includes/bootstrap.inc
Bootstrap page header: Invoke hook_boot(), intialize locking system, and send default HTTP headers.

Code

includes/bootstrap.inc, line 2246

<?php
function drupal_is_cli() {
  return (!isset($_SERVER['SERVER_SOFTWARE']) && (php_sapi_name() == 'cli' || (is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0)));
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.