Skip to content
Snippets Groups Projects
Unverified Commit 62ddaf7b authored by Matt Glaman's avatar Matt Glaman Committed by GitHub
Browse files

DIT-1366 SQLSanitize hook to remove authentication data (#213)

parent 8b005ec9
No related branches found
Tags 1.0.10
No related merge requests found
services:
acquia_dam.sql_sanitize:
class: Drupal\acquia_dam\Commands\SqlSanitizeCommands
arguments: ['@acquia_dam.authentication_service']
tags:
- { name: drush.command }
<?php
declare(strict_types=1);
namespace Drupal\acquia_dam\Commands;
use Consolidation\AnnotatedCommand\CommandData;
use Drupal\acquia_dam\AcquiadamAuthService;
use Drush\Commands\DrushCommands;
use Drush\Drupal\Commands\sql\SanitizePluginInterface;
use Symfony\Component\Console\Input\InputInterface;
/**
* Acquia DAM integration to SQL sanitize for Drush.
*/
final class SqlSanitizeCommands extends DrushCommands implements SanitizePluginInterface {
/**
* The auth service.
*
* @var \Drupal\acquia_dam\AcquiadamAuthService
*/
private AcquiadamAuthService $authService;
/**
* Constructs a new SqlSanitizeCommands object.
*
* @param \Drupal\acquia_dam\AcquiadamAuthService $auth_service
* The auth service.
*/
public function __construct(AcquiadamAuthService $auth_service) {
parent::__construct();
$this->authService = $auth_service;
}
/**
* Removes Acquia DAM authentication information from the database.
*
* {@inheritdoc}
*
* @hook post-command sql-sanitize
*/
public function sanitize($result, CommandData $commandData): void {
$this->authService->disconnectSiteAndUsers();
$this->logger()->success(dt('Acquia DAM authentication information remove.'));
}
/**
* {@inheritdoc}
*
* @hook on-event sql-sanitize-confirms
*/
public function messages(&$messages, InputInterface $input): void {
$messages[] = dt('Remove Acquia DAM authentication information.');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment