I'm using drush to load data into Open Atrium.

At the end of the purl_goto (http://drupalcode.org/project/purl.git/blob/HEAD:/purl.module#l710) there is an 'exit()' that kills any batch import.
My quick and dirty answer to that is to detect if we are using drush or not, the do an exit or a return.

  // The "Location" header sends a redirect status code to the HTTP daemon. In
  // some cases this can be wrong, so we make sure none of the code below the
  // drupal_goto() call gets executed upon redirection.
  if ($_SERVER['argv'][0] == '/space/admin/drush/drush.php') {
    return true;
  }
  exit();

Is there a way to do that in a cleaner way, like detecting if we are in an HTTP context or not?

Comments

scottrigby’s picture

Or something like this from Commons:

  // Exit if coming from the command-line (needed for drush)
  if (php_sapi_name() == 'cli') {
    return;
  }
bblake’s picture

What drush command are you running, and what modifiers do you have set up?

bblake’s picture

Status: Active » Postponed (maintainer needs more info)
bblake’s picture

I couldn't reproduce, can you please let me know what drush command you were running and modifiers you have set up so that I can reproduce?

bblake’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)