checking to see if we are running under drush?

Events happening in the community are now at Drupal community events on www.drupal.org.
tolland76's picture

Hi,

I had been using firePHP debugging in some of my install scripts and now I am using drush I am seeing some problems with headers like;
"Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive."

so I want to wrap my debugging function to check that its the browser or drush, is there a good strategy to do that??

Thanks,

Tom

Comments

from drush.php:

jonhattan's picture

from drush.php:

/**
* 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() {
  return (php_sapi_name() == 'cli' || (is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0));
}

drush

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: