Commit 15331b82 authored by ergonlogic's avatar ergonlogic

Issue #2471805: Add hook_provision_deploy_options_alter() invocations to...

Issue #2471805: Add hook_provision_deploy_options_alter() invocations to migrate and restore, and document it in te API.
parent 052b2b63
......@@ -99,7 +99,16 @@ function drush_provision_drupal_provision_migrate($platform, $new_name = NULL) {
drush_set_option('new_site_path', "{$options['root']}/sites/{$options['uri']}");
drush_invoke_process('@none', 'provision-save', array($target), $options);
provision_backend_invoke($target, 'provision-deploy', array(drush_get_option('backup_file')), array('old_uri' => d()->uri));
// Build an options array to pass to the deploy task. This allows injection
// of data into the deploy task. See: https://www.drupal.org/node/2471805
$deploy_options = array(
'old_uri' => d()->uri,
'strict' => 0,
);
drush_command_invoke_all_ref('provision_deploy_options_alter', $deploy_options, 'migrate');
provision_backend_invoke($target, 'provision-deploy', array(drush_get_option('backup_file')), $deploy_options);
if (!drush_get_error()) {
drush_log(dt("Bringing site out of maintenance"));
d()->site_enabled = TRUE;
......
......@@ -35,8 +35,15 @@ function drush_provision_drupal_pre_provision_restore_rollback($restore_file) {
* Switch the restore directories around now that we have the new db installed
*/
function drush_provision_drupal_provision_restore($restore_file) {
// Build an options array to pass to the deploy task. This allows injection
// of data into the deploy task. See: https://www.drupal.org/node/2471805
$deploy_options = array(
'old_uri' => d()->uri,
'strict' => 0,
);
drush_command_invoke_all_ref('provision_deploy_options_alter', $deploy_options, 'restore');
provision_backend_invoke(d()->name, 'provision-deploy', array(drush_get_option('restore_file')), array('old_uri' => d()->uri));
provision_backend_invoke(d()->name, 'provision-deploy', array(drush_get_option('restore_file')), $deploy_options);
if (!drush_get_error()) {
provision_backend_invoke(d()->name, 'provision-verify');
drush_set_option('installed', false);
......
......@@ -251,3 +251,21 @@ function hook_provision_drupal_chmod_not_recursive_directories_alter($chmod_not_
function hook_provision_drupal_install_settings_alter(&$settings, $url) {
$settings['forms']['install_configure_form']['update_status_module'] = array();
}
/**
* Alter the options passed to 'provision-deploy' when it is invoked in
* restore, clone and migrate tasks.
*
* @param array $deploy_options
* Options passed to the invocation of provision-deploy.
* @param string $context
* The type of task invoking the hook (e.g., 'clone').
*/
function hook_provision_deploy_options_alter(&$deploy_options, $context) {
// From hosting_s3; see: https://www.drupal.org/node/2412563
// Inject the backup bucket name during the 'clone' task, so that it is
// available in deploy().
if ($bucket = drush_get_option('s3_backup_name', FALSE)) {
$deploy_options['s3_backup_name'] = $bucket;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment