I'm working on a legacy site that uses IP Login, and on a local dev copy I set my login IP to 127.0.0.1. From the front end this seemed to work just fine. However, any Drush command that bootstraps the dev site now throws:
Drush command terminated abnormally due to an unrecoverable error. [error]
With --debug, the last thing drush sees is:
WD user: Session opened for jimmybob by IP Login. [0.54 sec, 40.9 MB] [notice]
strace shows the login message "You have been automatically logged in..." as its last WRITE before the error.
Changing the IP or disabling IP Login eliminates the problem.
Can anyone reproduce this? I just updated to core 6.28 and drush 5.8, but had same behavior in 6.26 and drush 4.4.

Comments

davidwhthomas’s picture

This issue has been fixed in the 7.x branch with a drupal_is_cli() check:

/**
 * Implementation of hook_boot().
 *
 *   see http://drupal.org/node/509028
 */
function ip_login_boot() {
  // skip rest of this if user is logged in, or via cli ( e.g drush )
  global $user;
  if ($user->uid != 0 || drupal_is_cli()) return;

vs D6 version:

/**
 * Implementation of hook_boot().
 *
 *   see http://drupal.org/node/509028
 */
function ip_login_boot() {
  // skip rest of this if user is logged in
  global $user;
  if ($user->uid != 0) return;
JCMeador’s picture

I don't see drupal_is_cli() in the D6 API (looks like it's in Pressflow 6 and D7 onwards).
Any thoughts on how to proceed? Defining the function in IP Login seems like a quick and dirty solution.

jim kirkpatrick’s picture

Category: support » feature

We need to support D6 & Drush, marking as a FR.

jim kirkpatrick’s picture

Status: Active » Needs review

Found an answer:

function ip_login_boot() {
  // skip rest of this if user is logged in
  global $user;
  if ($user->uid != 0 && function_exists('drush_main')) return;

Please test!

arpitr’s picture

/**
* Implementation of hook_boot().
*
*   see http://drupal.org/node/509028
*/
function ip_login_boot() {
  // skip rest of this if user is logged in, or via cli ( e.g drush )
  global $user;
  if ($user->uid != 0 || drupal_is_cli()) return;

works with drush in D7

johnpitcairn’s picture

Issue summary: View changes

Note the check in #1 is only included in the 7.x-3.x branch.
7.x-3.0-beta1 includes it.

amateescu’s picture

Status: Needs review » Closed (outdated)

Closing old issues.