acsf_duplication.module in Acquia Cloud Site Factory Connector 8.2
Same filename and directory in other branches
Provides site duplication handlers.
This is generally only needed during initial site duplication, while the duplicated site is being prepared to hand off to the user.
File
acsf_duplication/acsf_duplication.moduleView source
<?php
/**
* @file
* Provides site duplication handlers.
*
* This is generally only needed during initial site duplication, while the
* duplicated site is being prepared to hand off to the user.
*/
/**
* Implements hook_acsf_registry().
*/
function acsf_duplication_acsf_registry() {
$scrub_handlers = [
'\\Drupal\\acsf\\Event\\AcsfDuplicationScrubInitializeHandler' => -100,
'\\Drupal\\acsf\\Event\\AcsfDuplicationScrubConfigurationHandler' => 10,
'\\Drupal\\acsf\\Event\\AcsfDuplicationScrubCommentHandler' => 20,
'\\Drupal\\acsf\\Event\\AcsfDuplicationScrubNodeHandler' => 30,
'\\Drupal\\acsf\\Event\\AcsfDuplicationScrubUserHandler' => 40,
'\\Drupal\\acsf\\Event\\AcsfDuplicationScrubTemporaryFilesHandler' => 50,
'\\Drupal\\acsf\\Event\\AcsfDuplicationScrubTruncateTablesHandler' => 70,
'\\Drupal\\acsf\\Event\\AcsfDuplicationScrubFinalizeHandler' => 100,
];
foreach ($scrub_handlers as $class => $weight) {
$events[] = [
'type' => 'site_duplication_scrub',
'class' => $class,
'weight' => $weight,
];
}
return [
'events' => $events,
];
}
/**
* Alters the scrub event context of `drush acsf-duplication-scrub-batch`.
*
* Use this alter hook to add optional data to the scrub event. The data added
* here is available via the $this->event->context array in event handlers.
*
* @param array $data
* An associative array of context data needed in the event handlers.
*
* @see drush_acsf_duplication_scrub_batch()
*/
function acsf_duplication_acsf_duplication_scrub_context_alter(array &$data, $options) {
$exact_copy = isset($options['exact-copy']) ? $options['exact-copy'] : NULL;
$scrub_options['retain_users'] = isset($options['retain-users']) ? $options['retain-users'] : $exact_copy;
$scrub_options['retain_content'] = isset($options['retain-content']) ? $options['retain-content'] : $exact_copy;
$batch = isset($options['batch']) ? $options['batch'] : 1000;
$scrub_options['batch_comment'] = isset($options['batch-comment']) ? $options['batch-comment'] : $batch;
$scrub_options['batch_node'] = isset($options['batch-node']) ? $options['batch-node'] : $batch;
$scrub_options['batch_user'] = isset($options['batch-user']) ? $options['batch-user'] : $batch;
$data['scrub_options'] = array_merge($data['scrub_options'], $scrub_options);
}
Functions
Name | Description |
---|---|
acsf_duplication_acsf_duplication_scrub_context_alter | Alters the scrub event context of `drush acsf-duplication-scrub-batch`. |
acsf_duplication_acsf_registry | Implements hook_acsf_registry(). |