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

/**
 * Implements hook_drush_command().
 */
gbyte.co's avatar
gbyte.co 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.',
gbyte.co's avatar
gbyte.co 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.
 */
gbyte.co's avatar
gbyte.co committed
24
function drush_simple_sitemap_generate() {
25
  $sitemap = \Drupal::service('simple_sitemap.generator');
26
  $sitemap->generateSitemap('drush');
27
}