7.x bootstrap.inc drupal_is_cli()

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

1 call to drupal_is_cli()
drupal_page_is_cacheable in includes/bootstrap.inc
Determines the cacheability of the current page.

File

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

Comments

donquixote’s picture