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

gbyte.co's avatar
gbyte.co committed
7
use Drupal\simple_sitemap\Simplesitemap;
8 9 10 11

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

/**
 * Callback function for hook_drush_command().
 *
 * Regenerate sitemap for all languages.
 */
gbyte.co's avatar
gbyte.co committed
26
function drush_simple_sitemap_generate() {
27
  $sitemap = new Simplesitemap;
gbyte.co's avatar
gbyte.co committed
28
  $sitemap->generate_sitemap('drush');
29
}