class SqlSanitizeCommands in URLs queuer 8
Sanitize plugin for Drush sql:sanitize which clears the URL registry.
Hierarchy
- class \Drupal\purge_queuer_url\Commands\SqlSanitizeCommands extends \Drush\Commands\DrushCommands implements \Drush\Drupal\Commands\sql\SanitizePluginInterface
Expanded class hierarchy of SqlSanitizeCommands
1 string reference to 'SqlSanitizeCommands'
1 service uses SqlSanitizeCommands
File
- src/
Commands/ SqlSanitizeCommands.php, line 16
Namespace
Drupal\purge_queuer_url\CommandsView source
class SqlSanitizeCommands extends DrushCommands implements SanitizePluginInterface {
/**
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* The traffic registry with the stored URLs and tags.
*
* @var \Drupal\purge_queuer_url\TrafficRegistryInterface
*/
protected $registry;
/**
* Constructs a SqlSanitizeCommands object.
*
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
* @param \Drupal\purge_queuer_url\TrafficRegistryInterface $registry
* The traffic registry with the stored URLs and tags.
*/
public function __construct(ModuleHandlerInterface $module_handler, TrafficRegistryInterface $registry) {
$this->moduleHandler = $module_handler;
$this->registry = $registry;
}
/**
* Clear Purge URLs queuer traffic history.
*
* @hook post-command sql-sanitize
*
* @inheritdoc
*/
public function sanitize($result, CommandData $commandData) {
if ($this
->applies()) {
$this->registry
->clear();
}
}
/**
* Return the messages.
*
* @hook on-event sql-sanitize-confirms
*
* @inheritdoc
*/
public function messages(&$messages, InputInterface $input) {
if ($this
->applies()) {
$messages[] = dt('Clear Purge URLs queuer traffic history.');
}
return [];
}
/**
* Verify if the module is enabled.
*/
protected function applies() {
Drush::bootstrapManager()
->doBootstrap(DRUSH_BOOTSTRAP_DRUPAL_FULL);
return $this->moduleHandler
->moduleExists('purge_queuer_url');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SqlSanitizeCommands:: |
protected | property | The module handler. | |
SqlSanitizeCommands:: |
protected | property | The traffic registry with the stored URLs and tags. | |
SqlSanitizeCommands:: |
protected | function | Verify if the module is enabled. | |
SqlSanitizeCommands:: |
public | function | Return the messages. | |
SqlSanitizeCommands:: |
public | function | Clear Purge URLs queuer traffic history. | |
SqlSanitizeCommands:: |
public | function | Constructs a SqlSanitizeCommands object. |