simple_sitemap.drush.inc 1.12 KB
Newer Older
1
<?php
gbyte.co's avatar
gbyte.co committed
2

3 4
/**
 * @file
gbyte.co's avatar
gbyte.co committed
5
 * Drush (< 9) integration.
6 7 8 9 10
 */

/**
 * Implements hook_drush_command().
 */
gbyte.co's avatar
gbyte.co committed
11
function simple_sitemap_drush_command() {
12
  $items['simple-sitemap-generate'] = [
13
    'description' => 'Regenerate the XML sitemaps according to the module settings.',
gbyte.co's avatar
gbyte.co committed
14
    'callback' => 'drush_simple_sitemap_generate',
15
    'drupal dependencies' => ['simple_sitemap'],
16
    'aliases' => ['ssg'],
17
  ];
18

19
  $items['simple-sitemap-rebuild-queue'] = [
20 21 22
    'description' => 'Rebuild the sitemap queue for all sitemap variants.',
    'callback' => 'drush_simple_sitemap_rebuild_queue',
    'drupal dependencies' => ['simple_sitemap'],
23
    'aliases' => ['ssr'],
24 25
  ];

26 27 28 29 30 31
  return $items;
}

/**
 * Callback function for hook_drush_command().
 *
32
 * Regenerate the XML sitemaps according to the module settings.
33
 */
gbyte.co's avatar
gbyte.co committed
34
function drush_simple_sitemap_generate() {
gbyte.co's avatar
gbyte.co committed
35
  \Drupal::service('simple_sitemap.generator')->generateSitemap('drush');
36
}
37 38 39 40 41 42 43 44 45

/**
 * Callback function for hook_drush_command().
 *
 * Rebuild the sitemap queue for all sitemap variants.
 */
function drush_simple_sitemap_rebuild_queue() {
  \Drupal::service('simple_sitemap.generator')->rebuildQueue();
}