Drush will fail if this module is enabled. Basically, with drush, there is no web server so the drupal_goto call make it choke.
Here's a quick fix to allow this to work with drush.
At the top of the require_login_init() function add:
if ( ! variable_get("require_login_enabled", TRUE)) { // Allow drush to request user security check be ignored
return;
}
Then you can add the following code to your drupalrc.ini:
$override = array(
'require_login_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 the site's security is compromised anyway....
Comments
Comment #1
whayes commentedProbably need to change drupalrc.ini above to drushrc.php. It worked with drushrc.php, and I couldn't find drupalrc.ini.
Thanks for the fix - just what I needed after a couple of days of trying to figure out why drush wouldn't work.
Comment #2
jonhattanThe sanctioned way to detech drush is running is to check the existance of function drush_main. See:
http://drupal.org/node/1230132#comment-4790690
Comment #3
dwatts3624 commentedPer jonhattan's comment, could we wrap this module...
I can confirm that this fixes the issue.
The code is perfect other than the fact that it breaks Drush.
Thanks!
Comment #4
benclark commentedI just encountered this issue as well. I've attached a patch that combines both solutions above (the variable_get() and the function_exists() call).
Comment #5
stijndm commentedI believe the proper way of handling drush is by using drupal_is_cli().
http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/drupa...
This will return true is, for example, Drupal is called by drush.
Comment #6
Jeffrey C. commentedNeed a rerolled patch. Can someone work on it?
Comment #7
bobooon commentedDrupal 6 support has ended with Require Login. Please upgrade to Drupal 7 and Require Login version 7.x-2.0.
NOTE: The drupal_is_cli() check is included in the Drupal 7 version.