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.
I have a module similar to require_login that causes drush to fail. E.g., the cookies/header can't be written errors occur.
I've tried the tricks listed for the securepages module, but that seems to only change a variable setting and does not really disable the module.
Is there a way to tell Drush to not include a specific module in it's bootstrap process without changing the website/db settings? E.g., ignore login requirement for command line items but still enforce it on the website?
Seems like there should be a way to do this in the drupalrc but I can't find any docs/examples.
TIA
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentednot possible yet in core drupal. help welcome at #625444: Override enabled module/theme list dynamically using variable override in settings.php
Comment #2
cgmonroe CreditAttribution: cgmonroe commentedThanks. I had a suspicion that might be the case.
Just in case anyone else needs a work around. Here's what I did:
I found that the culprit in my mod was a drupal_goto call. So I added a bit of code at the top of the hook using this that looked like:
Then I created a drupalrc.ini in my sites/default directory that had the lines:
Now drush runs and the site's still secure. Well.. not if someone can set this variable via the web... but if they can do that my security's compromised anyway....
Comment #4
xjmFor securepages/drush compatibility, see also #599948: conflict with drush (headers already sent).
Comment #5
greg.1.anderson CreditAttribution: greg.1.anderson commentedIt might be better to check for drush via
function_exists('drush_main')
; then you would not need the override.