function drupal_is_cli

drupal_is_cli()

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

File

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!bootstrap.inc/function/drupal_is_cli/7.x