src/Robo/Commands/Artifact/AcHooksCommand.php
public function dbScrub($site, $target_env, $db_name, $source_env) {
    if (!EnvironmentDetector::isAcsfEnv($site, $target_env)) {
      $password = RandomString::string(10, FALSE,
        function ($string) {
          return !preg_match('/[^\x{80}-\x{F7} a-z0-9@+_.\'-]/i', $string);
        },
        'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!#%^&*()_?/.,+=><'
      );
      $this->say("Scrubbing database in $target_env");
      $result = $this->taskDrush()
        ->drush("sql-sanitize --sanitize-password=\"$password\" --yes")
        ->run();
      if (!$result->wasSuccessful()) {
        throw new BltException("Failed to sanitize database!");
      }
      $this->taskDrush()
        ->drush("cr")
        ->run();
    }
  }
public function dbScrub($site, $target_env, $db_name, $source_env) {
    if (!EnvironmentDetector::isAcsfEnv($site, $target_env)) {
      $password = RandomString::string(10, FALSE,
        function ($string) {
          return !preg_match('/[^\x{80}-\x{F7} a-z0-9@+_.\'-]/i', $string);
        },
        'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!#%^&*()_?/.,+=><'
      );
      $this->say("Scrubbing database in $target_env");
      $result = $this->taskDrush()
        ->drush("sql-sanitize --sanitize-password=\"$password\" --yes")
        ->run();
      if (!$result->wasSuccessful()) {
        throw new BltException("Failed to sanitize database!");
      }
      $this->taskDrush()
        ->drush("cr")
        ->run();
    }
  }
public function dbScrub ( $ site , $ target_env , $ db_name , $ source_env ) { if ( ! EnvironmentDetector :: isAcsfEnv ( $ site , $ target_env ) ) { $ password = RandomString :: string ( 10 , FALSE , function ( $ string ) { return ! preg_match ( '/[^\x{80}-\x{F7} a-z0-9@+_.\'-]/i' , $ string ) ; } , 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!#%^&*()_?/.,+=><' ) ; $ this -> say ( "Scrubbing database in $target_env" ) ; $ result = $ this -> taskDrush ( ) -> drush ( "sql-sanitize --sanitize-password=\"$password\" --yes" ) -> run ( ) ; if ( ! $ result -> wasSuccessful ( ) ) { throw new BltException ( "Failed to sanitize database!" ) ; } $ this -> taskDrush ( ) -> drush ( "cr" ) -> run ( ) ; } }
Execute sql-sanitize against a database hosted in AC Cloud.

This is intended to be called from db-scrub.sh cloud hook.

@param string $site
The site name, e.g., site1.
@param string $target_env
The cloud env, e.g., dev
@param string $db_name
The name of the database.
@param string $source_env
The source environment.
@command artifact:ac-hooks:db-scrub

@throws \Exception
Execute sql - sanitize against a database hosted in AC Cloud .