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

moshe weitzman’s picture

Status: Active » Fixed
cgmonroe’s picture

Thanks. 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:

  if ( ! variable_get("my_module_enabled", TRUE)) { // Ignore user security check for drush
    return;
  }

Then I created a drupalrc.ini in my sites/default directory that had the lines:

$override = array(
   'my_module_enabled' => FALSE, // Disabling security check for drush.
);

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....

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

xjm’s picture

For securepages/drush compatibility, see also #599948: conflict with drush (headers already sent).

greg.1.anderson’s picture

It might be better to check for drush via function_exists('drush_main'); then you would not need the override.