You are here

class GdprSanitize in General Data Protection Regulation 3.0.x

Same name and namespace in other branches
  1. 8.2 modules/gdpr_dump/src/Service/GdprSanitize.php \Drupal\gdpr_dump\Service\GdprSanitize
  2. 8 modules/gdpr_dump/src/Service/GdprSanitize.php \Drupal\gdpr_dump\Service\GdprSanitize

Class GdprSqlDump.

@package Drupal\gdpr_dump\Service

Hierarchy

Expanded class hierarchy of GdprSanitize

1 file declares its use of GdprSanitize
GdprDumpCommands.php in modules/gdpr_dump/src/Commands/GdprDumpCommands.php
1 string reference to 'GdprSanitize'
gdpr_dump.services.yml in modules/gdpr_dump/gdpr_dump.services.yml
modules/gdpr_dump/gdpr_dump.services.yml
1 service uses GdprSanitize
gdpr_dump.sanitize in modules/gdpr_dump/gdpr_dump.services.yml
Drupal\gdpr_dump\Service\GdprSanitize

File

modules/gdpr_dump/src/Service/GdprSanitize.php, line 12

Namespace

Drupal\gdpr_dump\Service
View source
class GdprSanitize extends GdprSqlDump {

  /**
   * Go through the data and sanitize it.
   *
   * @throws \Exception
   */
  public function sanitize() {
    $this->sql = $this
      ->getInstance();
    $this
      ->prepare();
    $this
      ->rename();
  }

  /**
   * Rename the cloned tables to the original tables.
   */
  protected function rename() {
    $transaction = $this->database
      ->startTransaction('gdpr_rename_table');
    foreach (array_keys($this->tablesToAnonymize) as $table) {
      $gdprTable = self::GDPR_TABLE_PREFIX . $table;
      $this->database
        ->schema()
        ->dropTable($table);
      $this->database
        ->schema()
        ->renameTable($gdprTable, $table);
    }
    $this->database
      ->popTransaction($transaction
      ->name());
  }

}

Members

Namesort descending Modifiers Type Description Overrides
GdprSanitize::rename protected function Rename the cloned tables to the original tables.
GdprSanitize::sanitize public function Go through the data and sanitize it.
GdprSqlDump::$database protected property The database.
GdprSqlDump::$databaseManager protected property GDPR database manager.
GdprSqlDump::$driver protected property The database driver.
GdprSqlDump::$pluginFactory protected property The Sanitizer plugin factory.
GdprSqlDump::$sql protected property The SQL instance.
GdprSqlDump::$tablesToAnonymize protected property The GDPR table settings.
GdprSqlDump::$tablesToSkip protected property The list of tables needed to be skipped.
GdprSqlDump::buildTablesToSkip protected function Builds tablesToSkip array.
GdprSqlDump::cleanup protected function Cleanup the database after the dump.
GdprSqlDump::createCloneQueryString protected function Creates a query string for cloning.
GdprSqlDump::createTableClones protected function Creates table clones according to the config.
GdprSqlDump::dump public function Dump command.
GdprSqlDump::GDPR_TABLE_PREFIX constant
GdprSqlDump::getInstance protected function Get a SqlBase instance according to dbSpecs.
GdprSqlDump::prepare protected function Prepare the database for the dump.
GdprSqlDump::sanitizeData protected function Go through the data and sanitize it.
GdprSqlDump::__construct public function GdprSqlDump constructor.