Posted by R.J. Steinert on June 7, 2011 at 2:33pm
5 followers
| Project: | Drush |
| Version: | All-versions-4.x-dev |
| Component: | Documentation |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hey Drushies - I have some particular code that kills drush and I would like to throw a conditional in there to not to run that code when Drush is executing the bootstrap. Is there a global or something I can check to make sure it's not Drush running?
Comments
#1
<?phpif (!function_exists('drush_verify_cli')) {
// do stuff.
}
?>
#2
Okay, this is perhaps the most picky re-open ever. :)
I was thinking that whatever function we recommend here should be guaranteed to never change, regardless of drush version, and furthermore, we should document the function as being the sanctioned function to check for in modules.
I think that drush_verify_cli is a pretty good choice, but I slightly prefer drush_main. Either way, it just needs a comment in drush.php to advertise the policy.
#3
Awesome! Thanks guys :).
#4
Here is a comment that recommends using drush_main.
#5
That's fine with me. I just suggested drush_verify_cli because I saw features module was already using it, but drush_main is probably less likely to change.
#6
Committed
#7
Automatically closed -- issue fixed for 2 weeks with no activity.