You are here

public function Delete::execute in Drupal 7 to 8/9 Module Upgrader 8

Executes the plugin.

Overrides ExecutableInterface::execute

File

src/Plugin/DMU/Fixer/Delete.php, line 16

Class

Delete
Plugin annotation @Fixer( id = "delete" )

Namespace

Drupal\drupalmoduleupgrader\Plugin\DMU\Fixer

Code

public function execute() {
  foreach ($this
    ->getObjects() as $node) {
    $node
      ->remove();
  }
  $this->target
    ->save();

  // Rebuild the index so it won't contain non-existent crap.
  $indexer = $this->target
    ->getIndexer($this->configuration['type']);
  $indexer
    ->clear();
  $indexer
    ->build();
}