You are here

function xmlsitemap_run_unprogressive_batch in XML sitemap 7.2

Same name and namespace in other branches
  1. 8 xmlsitemap.module \xmlsitemap_run_unprogressive_batch()
  2. 6.2 xmlsitemap.module \xmlsitemap_run_unprogressive_batch()
  3. 2.x xmlsitemap.module \xmlsitemap_run_unprogressive_batch()

Run a not-progressive batch operation.

3 calls to xmlsitemap_run_unprogressive_batch()
drush_xmlsitemap_rebuild in ./xmlsitemap.drush.inc
Dump and rebuild all the sitemap data, then regenerate the files.
drush_xmlsitemap_regenerate in ./xmlsitemap.drush.inc
Regenerate the sitemap files from existing data.
xmlsitemap_cron in ./xmlsitemap.module
Implements hook_cron().

File

./xmlsitemap.module, line 1637
xmlsitemap XML sitemap

Code

function xmlsitemap_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 https://www.drupal.org/node/638712 is fixed.
  $batch =& batch_get();
  $batch['progressive'] = FALSE;

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