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

CommentFileSizeAuthor
#4 828164-4.patch610 bytesbenclark

Comments

whayes’s picture

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

jonhattan’s picture

The sanctioned way to detech drush is running is to check the existance of function drush_main. See:

http://drupal.org/node/1230132#comment-4790690

dwatts3624’s picture

Per jonhattan's comment, could we wrap this module...

if (!function_exists('drush_main')) { 
// module contents
}

I can confirm that this fixes the issue.

The code is perfect other than the fact that it breaks Drush.

Thanks!

benclark’s picture

StatusFileSize
new610 bytes

I just encountered this issue as well. I've attached a patch that combines both solutions above (the variable_get() and the function_exists() call).

stijndm’s picture

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

Jeffrey C.’s picture

Category: feature » task

Need a rerolled patch. Can someone work on it?

bobooon’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

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