function xmlsitemap_node_cron in XML sitemap 7.2
Same name and namespace in other branches
- 5 xmlsitemap_node/xmlsitemap_node.module \xmlsitemap_node_cron()
- 6.2 xmlsitemap_node/xmlsitemap_node.module \xmlsitemap_node_cron()
- 6 xmlsitemap_node/xmlsitemap_node.module \xmlsitemap_node_cron()
Implements hook_cron().
Process old nodes not found in the {xmlsitemap} table.
1 call to xmlsitemap_node_cron()
- XMLSitemapNodeFunctionalTest::testCron in xmlsitemap_node/
xmlsitemap_node.test - Test the import of old nodes via cron.
File
- xmlsitemap_node/
xmlsitemap_node.module, line 24 - Default file for XML sitemap node.
Code
function xmlsitemap_node_cron() {
$limit = xmlsitemap_var('batch_limit');
// Process nodes that have been queued in hook_node_update().
$queue = DrupalQueue::get('xmlsitemap_node');
while ($limit > 0 && ($item = $queue
->claimItem())) {
$limit--;
try {
$node = node_load($item->data);
// The node could have been deleted in the meantime, skip XML sitemap
// updates in this case.
if ($node) {
$link = xmlsitemap_node_create_link($node);
xmlsitemap_link_save($link, array(
$link['type'] => $node,
));
}
$queue
->deleteItem($item);
} catch (Exception $e) {
// In case of exception log it and leave the item in the queue
// to be processed again later.
watchdog_exception('xmlsitemap_node', $e);
}
}
// Add nodes that are missing from the {xmlsitemap} table.
// This catches nodes that were created prior to this module being enabled.
xmlsitemap_node_xmlsitemap_index_links($limit);
}