Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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?
Comment | File | Size | Author |
---|---|---|---|
#4 | document-fn-exists-drush-main.patch | 450 bytes | greg.1.anderson |
Comments
Comment #1
msonnabaum CreditAttribution: msonnabaum commentedComment #2
greg.1.anderson CreditAttribution: greg.1.anderson commentedOkay, 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.
Comment #3
R.J. Steinert CreditAttribution: R.J. Steinert commentedAwesome! Thanks guys :).
Comment #4
greg.1.anderson CreditAttribution: greg.1.anderson commentedHere is a comment that recommends using drush_main.
Comment #5
msonnabaum CreditAttribution: msonnabaum commentedThat'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.
Comment #6
moshe weitzman CreditAttribution: moshe weitzman commentedCommitted