function drupal_is_cli

7.x 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/includes/
Determines the cacheability of the current page.
drupal_session_start in drupal/includes/
Starts a session forcefully, preserving already set session data.
_drupal_bootstrap_page_header in drupal/includes/
Invokes hook_boot(), initializes locking system, and sends HTTP headers.
_drupal_log_error in drupal/includes/
Logs a PHP error or exception and displays an error page in fatal cases.


drupal/includes/, line 3399
Functions that need to be loaded on every Drupal request.


function drupal_is_cli() {
  return (!isset($_SERVER['SERVER_SOFTWARE']) && (php_sapi_name() == 'cli' || (is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0)));