function drupal_is_cli

You are here

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


includes/, line 3381
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)));