Commit c5d9beb1 authored by badjava's avatar badjava Committed by gbyte.co

Issue #2912684 by badjava: Add Drush 9 command support

parent 3b4a2975
......@@ -90,3 +90,10 @@ services:
public: false
arguments:
- simple_sitemap
simple_sitemap.commands:
class: \Drupal\simple_sitemap\Commands\SimpleSitemapCommands
arguments:
- '@simple_sitemap.generator'
tags:
- { name: drush.command }
<?php
namespace Drupal\simple_sitemap\Commands;
use Drupal\simple_sitemap\Simplesitemap;
use Drush\Commands\DrushCommands;
/**
* Class SimpleSitemapCommands
* @package Drupal\simple_sitemap\Commands
*/
class SimpleSitemapCommands extends DrushCommands {
/**
* @var \Drupal\simple_sitemap\Simplesitemap
*/
protected $generator;
/**
* SimpleSitemapCommands constructor.
* @param \Drupal\simple_sitemap\Simplesitemap $generator
*/
public function __construct(Simplesitemap $generator) {
$this->generator = $generator;
}
/**
* Regenerate XML sitemaps for all languages according to the module settings.
*
* @command simple-sitemap:generate
* @aliases ss:generate, ssg
*/
public function generate() {
$this->generator->generateSitemap('drush');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment