You are here

function redirect_run_unprogressive_batch in Redirect 7

Same name and namespace in other branches
  1. 8 redirect.drush.inc \redirect_run_unprogressive_batch()
  2. 7.2 redirect.drush.inc \redirect_run_unprogressive_batch()

Perform an unprogressive batch process for CLI.

1 call to redirect_run_unprogressive_batch()
drush_redirect_generate_redirects in ./redirect.drush.inc
Command callback. Generate a number of redirects.

File

./redirect.drush.inc, line 97
Drush integration for the redirect module.

Code

function redirect_run_unprogressive_batch() {
  $batch = batch_get();
  if (!empty($batch)) {

    // If there is already something in the batch, don't run.
    return FALSE;
  }
  $args = func_get_args();
  $batch_callback = array_shift($args);
  if (!lock_acquire($batch_callback)) {
    return FALSE;
  }

  // Attempt to increase the execution time.
  drupal_set_time_limit(240);

  // Build the batch array.
  $batch = call_user_func_array($batch_callback, $args);
  batch_set($batch);

  // We need to manually set the progressive variable again.
  // @todo Remove when http://drupal.org/node/638712 is fixed.
  $batch =& batch_get();
  $batch['progressive'] = FALSE;

  // Run the batch process.
  batch_process();
  lock_release($batch_callback);
  return TRUE;
}