Posted by joachim on August 13, 2009 at 10:53pm
Jump to:
| Project: | Drush |
| Version: | All-Versions-2.0 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I've just created this module: http://drupal.org/project/holding
and I've found that running drush on my site that runs it shows me the holding page...
So I'd like to add an exception to my module.
What's the simplest way to detect whether Drupal is being run by Drush?
Comments
#1
Among other things, the $_SERVER and $_REQUEST is going to look totally different. Is that a start?
print_r() it and you'll see something you can grab.
#2
#3
Automatically closed -- issue fixed for 2 weeks with no activity.
#4
The Drupal 7 solution to this would be
drupal_is_cli(), which detects whether the current script is running in a command-line environment. (Nice.) Ex:<?php
if (drupal_is_cli()) {
return; // Good-bye Drush!
}
drupal_goto('http://www.google.com/');
?>