function xmlsitemap_rebuild_batch in XML sitemap 7.2
Same name and namespace in other branches
- 8 xmlsitemap.module \xmlsitemap_rebuild_batch()
- 6.2 xmlsitemap.generate.inc \xmlsitemap_rebuild_batch()
- 2.x xmlsitemap.module \xmlsitemap_rebuild_batch()
Batch information callback for rebuilding the sitemap data.
1 call to xmlsitemap_rebuild_batch()
- xmlsitemap_rebuild_form_submit in ./
xmlsitemap.admin.inc - Submit handler; Starts the sitemap rebuild batch.
1 string reference to 'xmlsitemap_rebuild_batch'
- drush_xmlsitemap_rebuild in ./
xmlsitemap.drush.inc - Dump and rebuild all the sitemap data, then regenerate the files.
File
- ./
xmlsitemap.generate.inc, line 418 - Sitemap generation and rebuilding functions for the xmlsitemap module.
Code
function xmlsitemap_rebuild_batch(array $entities, $save_custom = FALSE) {
$batch = array(
'operations' => array(),
'finished' => 'xmlsitemap_rebuild_batch_finished',
'title' => t('Rebuilding Sitemap'),
'file' => drupal_get_path('module', 'xmlsitemap') . '/xmlsitemap.generate.inc',
);
// Set the rebuild flag in case something fails during the rebuild.
$batch['operations'][] = array(
'xmlsitemap_batch_variable_set',
array(
array(
'xmlsitemap_rebuild_needed' => TRUE,
),
),
);
// Purge any links first.
$batch['operations'][] = array(
'xmlsitemap_rebuild_batch_clear',
array(
$entities,
(bool) $save_custom,
),
);
// Fetch all the sitemap links and save them to the {xmlsitemap} table.
foreach ($entities as $entity) {
$info = xmlsitemap_get_link_info($entity);
$batch['operations'][] = array(
$info['xmlsitemap']['rebuild callback'],
array(
$entity,
),
);
}
// Clear the rebuild flag.
$batch['operations'][] = array(
'xmlsitemap_batch_variable_set',
array(
array(
'xmlsitemap_rebuild_needed' => FALSE,
),
),
);
// Add the regeneration batch.
$regenerate_batch = xmlsitemap_regenerate_batch();
$batch['operations'] = array_merge($batch['operations'], $regenerate_batch['operations']);
return $batch;
}