function drupal_is_cli
7.x bootstrap.inc | drupal_is_cli() |
Detects whether the current script is running in a command-line environment.
4 calls to drupal_is_cli()
- drupal_page_is_cacheable in drupal-7.x/
includes/ bootstrap.inc - Determines the cacheability of the current page.
- drupal_session_start in drupal-7.x/
includes/ session.inc - Starts a session forcefully, preserving already set session data.
- _drupal_bootstrap_page_header in drupal-7.x/
includes/ bootstrap.inc - Invokes hook_boot(), initializes locking system, and sends HTTP headers.
- _drupal_log_error in drupal-7.x/
includes/ errors.inc - Logs a PHP error or exception and displays an error page in fatal cases.
File
- drupal-7.x/
includes/ bootstrap.inc, line 3381 - Functions that need to be loaded on every Drupal request.
Code
function drupal_is_cli() {
return (!isset($_SERVER['SERVER_SOFTWARE']) && (php_sapi_name() == 'cli' || (is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0)));
}