acsf_duplication.module in Acquia Cloud Site Factory Connector 8
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) {
$exact_copy = drush_get_option('exact-copy');
$options['retain_users'] = drush_get_option('retain-users', $exact_copy);
$options['retain_content'] = drush_get_option('retain-content', $exact_copy);
$batch = drush_get_option('batch', 1000);
$options['batch_comment'] = drush_get_option('batch-comment', $batch);
$options['batch_node'] = drush_get_option('batch-node', $batch);
$options['batch_user'] = drush_get_option('batch-user', $batch);
$data['scrub_options'] = array_merge($data['scrub_options'], $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(). |