This site is a static archive of the Aegir community site. Documentation has moved to http://docs.aegirproject.org. Other community resources can be found on the Contacting the community page.
Skip navigation

Revision of Passing values into the site drushrc.php file during migrations from Fri, 10/28/2011 - 12:00

Help

Passing values into the site drushrc.php file during migrations

It's possible rely to on manipulating the context for certain tasks and using hook_post_command to make use of that data. In this case, I wanted to save values to the site's drushrc.php file.

Add the following code to hook_post_provision_verify:

<?php
if (d()->type == 'site') {
 
$val = drush_get_option('my_custom_option');
 
drush_set_option('my_custom_option', $val, 'site');
}
?>

This makes sure that my_custom_option perpetuates through these potentially destructive operations. Since it is provision-verify that writes the drushrc.php file for the site, options set in the site context during hook_post_provision_verify will be saved.

The final step is to make sure the verify hook is run with the appropriate options at the end of my migrate task, so add this to hook_post_provision_migrate.

<?php
if (d()->type == 'site') {
 
$options = array('my_custom_option' => drush_get_option('my_custom_option'));
 
$target = drush_get_option('target_name');
 
provision_backend_invoke($target, 'provision-verify', array(), $options);
}
?>

I got this idea from looking at the drush_provision_drupal_provision_migrate function in platform/migrate.provision.inc.

I used this approach to create a patch for provision_civicrm

This was originally documented in the provision issue queue.

Need help?

Documentation

The notebook section provides a way for you to store and share information with your group members. With the book feature you can:

  • Add book pages and organize them hierarchically into different books.
  • Attach files to pages to share them with others.
  • Track changes that others have made and revert changes as necessary.
  • Archive books that are no longer of interest to the group. Archived books can be reactivated later if needed.

The revisions let you track differences between multiple versions of a post.