drupal_is_cli

Versions
mediamosa-21
drupal_is_cli()

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

▾ 3 functions call drupal_is_cli()

drupal_page_is_cacheable in includes/bootstrap.inc
Determine the cacheability of the current page.
drupal_session_start in includes/session.inc
Forcefully start a session, preserving already set session data.
_drupal_bootstrap_page_header in includes/bootstrap.inc
Bootstrap page header: Invoke hook_boot(), initialize locking system, and send default HTTP headers.

Code

includes/bootstrap.inc, line 2627

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