Exemple #1
0
#!/usr/bin/env php
<?php 
// $Id: drush.php,v 1.24.2.4 2008/11/28 17:18:20 adrian Exp $
/**
 * @file
 * drush is a PHP script implementing a command line shell for Drupal.
 *
 * @requires PHP CLI 4.3.0, PHP CLI 5.x, or newer.
 */
define('DRUSH_DRUPAL_BOOTSTRAP', 'includes/bootstrap.inc');
// Terminate immediately unless invoked as a command line script
if (!drush_verify_cli()) {
    die('drush.php is designed to run via the command line.');
}
exit(drush_bootstrap($GLOBALS['argc'], $GLOBALS['argv']));
/**
 * Verify that we are running PHP through the command line interface.
 *
 * This function is useful for making sure that code cannot be run via the web server,
 * such as a function that needs to write files to which the web server should not have
 * access to.
 *
 * @return
 *   A boolean value that is true when PHP is being run through the command line, 
 *   and false if being run through cgi or mod_php.
 */
function drush_verify_cli()
{
    if (php_sapi_name() == 'cgi') {
        return is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0;
    }
Exemple #2
0
 public function clearScreen()
 {
     if (drush_verify_cli()) {
         drush_print("c");
     }
 }