You are here

public function QueuerCommands::queuerRemove in Purge 8.3

Remove a queuer.

@usage drush p:queuer-rm ID Remove the given queuer.

@command p:queuer-rm @aliases purm,p-queuer-rm

Parameters

string $id: The plugin ID of the queuer to remove.

array $options: Associative array of options whose values come from Drush.

File

modules/purge_drush/src/Commands/QueuerCommands.php, line 177

Class

QueuerCommands
Configure Purge queuers from the command line.

Namespace

Drupal\purge_drush\Commands

Code

public function queuerRemove($id, array $options = [
  'format' => 'string',
]) {
  $enabled = $this->purgeQueuers
    ->getPluginsEnabled();

  // Verify that the queuer exists.
  if (!in_array($id, $enabled)) {
    throw new \Exception(dt('The given plugin ID is not valid!'));
  }

  // Remove the queuer and finish command execution.
  unset($enabled[array_search($id, $enabled)]);
  $this->purgeQueuers
    ->setPluginsEnabled($enabled);
  if ($options['format'] == 'string') {
    $this
      ->io()
      ->success(dt('The queuer has been removed!'));
  }
}