You are here

function xmlsitemap_run_unprogressive_batch in XML sitemap 6.2

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

Run a 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 1414
Main file for the xmlsitemap module.

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 (function_exists('lock_acquire') && !lock_acquire($batch_callback)) {
    return FALSE;
  }

  // Attempt to increase the execution time.
  xmlsitemap_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();
  if (function_exists('lock_release')) {
    lock_release($batch_callback);
  }
  return TRUE;
}