Skip navigation
Help

drupal_is_cli

7 bootstrap.inc drupal_is_cli()

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

4 calls to drupal_is_cli()

File

drupal/includes/bootstrap.inc, line 2903
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)));
}