Download & Extend

Batch node creation fails after the first node

Project:Persistent URL
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

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

#1

Or something like this from Commons:

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