simple_sitemap.drush.inc 649 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
<?php
/**
 * @file
 * Drush integration.
 */

/**
 * Implements hook_drush_command().
 */
Pawel G's avatar
Pawel G committed
10 11
function simple_sitemap_drush_command() {
  $items['simple_sitemap-generate'] = array(
12
    'description' => 'Regenerate XML sitemaps for all languages according to the module settings.',
Pawel G's avatar
Pawel G committed
13 14
    'callback' => 'drush_simple_sitemap_generate',
    'drupal dependencies' => array('simple_sitemap'),
15 16 17 18 19 20 21 22 23
  );
  return $items;
}

/**
 * Callback function for hook_drush_command().
 *
 * Regenerate sitemap for all languages.
 */
Pawel G's avatar
Pawel G committed
24
function drush_simple_sitemap_generate() {
25
  $sitemap = \Drupal::service('simple_sitemap.generator');
Pawel G's avatar
Pawel G committed
26
  $sitemap->generate_sitemap('drush');
27
}