simple_sitemap_views.module in Simple XML sitemap (Views integration) 8
Contains simple_sitemap_views.module.
File
simple_sitemap_views.moduleView source
<?php
/**
* @file
* Contains simple_sitemap_views.module.
*/
/**
* Implements hook_cron().
*/
function simple_sitemap_views_cron() {
// The task queue of garbage collection in the index.
$queue = \Drupal::queue('simple_sitemap_views_garbage_collector');
// Check that the queue is empty.
if (!$queue
->numberOfItems()) {
// Get identifiers of indexed views.
$query = \Drupal::database()
->select('simple_sitemap_views', 'ssv');
$query
->addField('ssv', 'view_id');
$query
->distinct();
$result = $query
->execute()
->fetchCol();
// Create a garbage collection task.
foreach ($result as $view_id) {
$queue
->createItem([
'view_id' => $view_id,
]);
}
}
}
Functions
Name | Description |
---|---|
simple_sitemap_views_cron | Implements hook_cron(). |