function drush_acsf_duplication_scrub_batch in Acquia Cloud Site Factory Connector 8
Command callback. Scrubs some data on the duplicated site.
Runs one iteration of the batch scrubbing process.
File
- acsf_duplication/
acsf_duplication.drush.inc, line 67 - Provides drush commands necessary for site duplication.
Code
function drush_acsf_duplication_scrub_batch($site_name, $standard_domain) {
if (empty($site_name)) {
return drush_set_error(dt('You must provide the site name of the duplicated site as the first argument.'));
}
if (empty($standard_domain)) {
return drush_set_error(dt('You must provide the standard domain of the duplicated site as the second argument.'));
}
if (!\Drupal::moduleHandler()
->moduleExists('acsf')) {
return drush_set_error(dt('The ACSF module must be enabled.'));
}
$context = [
'site_name' => $site_name,
'standard_domain' => $standard_domain,
'scrub_options' => [
'avoid_oom' => drush_get_option('avoid-oom'),
],
];
\Drupal::moduleHandler()
->alter('acsf_duplication_scrub_context', $context);
ksort($context['scrub_options']);
// Load and execute the site duplication scrub event handlers.
$event = AcsfEvent::create('site_duplication_scrub', $context);
$event
->run();
// Return an error code if the process is incomplete.
if (\Drupal::state()
->get('acsf_duplication_scrub_status', NULL) !== 'complete') {
return drush_set_error(dt('The scrubbing of this site is incomplete. Please re-run the command to resume processing.'));
}
else {
drush_print(dt('The scrubbing of this site is complete.'));
}
}