You are here

public function XmlSitemapCommands::rebuild in XML sitemap 2.x

Same name and namespace in other branches
  1. 8 src/Commands/XmlSitemapCommands.php \Drupal\xmlsitemap\Commands\XmlSitemapCommands::rebuild()

Dump and re-process all possible XML sitemap data, then regenerate files.

@validate-module-enabled xmlsitemap

@command xmlsitemap:rebuild @aliases xmlsitemap-rebuild

File

src/Commands/XmlSitemapCommands.php, line 75

Class

XmlSitemapCommands
Drush commands for XML sitemap.

Namespace

Drupal\xmlsitemap\Commands

Code

public function rebuild() {

  // Build a list of rebuildable link types.
  $rebuild_types = xmlsitemap_get_rebuildable_link_types();
  if (empty($rebuild_types)) {
    $this
      ->logger()
      ->warning(dt('No link types are rebuildable.'));
  }
  $batch = xmlsitemap_rebuild_batch($rebuild_types, TRUE);
  batch_set($batch);
  drush_backend_batch_process();
}