You are here

class AcsfDuplicationScrubConfigurationHandler in Acquia Cloud Site Factory Connector 8

Same name and namespace in other branches
  1. 8.2 src/Event/AcsfDuplicationScrubConfigurationHandler.php \Drupal\acsf\Event\AcsfDuplicationScrubConfigurationHandler

Handles the scrubbing of Drupal core state / configuration.

Note that 'scrubbing' in our case doesn't mean just clearing configuration values but also initializing them for use in a new website.

Anything that is not specifically core or absolutely required by ACSF should live in a separate contrib / distribution specific module. (See e.g. gardens_duplication module in the Gardens distribution.)

Hierarchy

Expanded class hierarchy of AcsfDuplicationScrubConfigurationHandler

File

src/Event/AcsfDuplicationScrubConfigurationHandler.php, line 15

Namespace

Drupal\acsf\Event
View source
class AcsfDuplicationScrubConfigurationHandler extends AcsfEventHandler {

  /**
   * Implements AcsfEventHandler::handle().
   */
  public function handle() {
    drush_print(dt('Entered @class', [
      '@class' => get_class($this),
    ]));

    // Delete selected state values.
    $variables = [
      // The Acquia Connector module puts the below values in the state system
      // (because it's a general module, not only running on Acquia Hosting
      // infrastructure) but our actual authoritative values are in an include
      // file from Hosting, e.g. D8-<hosting_site>-common-settings.inc:
      // $config['ah_network_key'] and $config['ah_network_identifier']. So we
      // need to clear them here because they are stale after we do a cross-
      // sitegroup duplication. (Hosting/ACE has no method for this because only
      // ACSF ever does cross-sitegroup site copies.)
      'acquia_connector.identifier',
      'acquia_connector.key',
      'node.min_max_update_time',
      'system.cron_last',
      'system.private_key',
    ];
    $state_storage = \Drupal::state();
    foreach ($variables as $name) {
      $state_storage
        ->delete($name);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AcsfDuplicationScrubConfigurationHandler::handle public function Implements AcsfEventHandler::handle(). Overrides AcsfEventHandler::handle
AcsfEventHandler::$completed public property The time that the handler was completed.
AcsfEventHandler::$message public property Any messages triggered by the handler.
AcsfEventHandler::$started public property The time that the handler was started.
AcsfEventHandler::__construct public function Constructor. 1