diff --git a/hosting_reinstall/README.txt b/hosting_reinstall/README.txt new file mode 100644 index 0000000..9d0166a --- /dev/null +++ b/hosting_reinstall/README.txt @@ -0,0 +1,13 @@ +The Hosting Reinstall module provides a Drush command and Hosting task +so that you can easily reinstall sites in Aegir. + +It was originally written for the purpose of testing Drupal install profiles. +It is also useful for development feature/git-based workflows. + +Hosting Reinstall was originally written Stuart Clark and maintained by Stuart +Clark (deciphered) of Realityloop Pty Ltd. +- http://www.realityloop.com +- http://twitter.com/realityloop + +The port to Aegir 3 and its on-going maintenance is by Christopher Gervais +(ergonlogic). diff --git a/hosting_reinstall/drush/provision_site_reinstall.drush.inc b/hosting_reinstall/drush/provision_site_reinstall.drush.inc new file mode 100644 index 0000000..ff3a1bd --- /dev/null +++ b/hosting_reinstall/drush/provision_site_reinstall.drush.inc @@ -0,0 +1,40 @@ + 'Reinstall a site.', + 'examples' => array( + 'drush @site provision-reinstall' => 'Invokes Provision Delete and Install tasks to simulate a site reinstall.', + ), + 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT + ); + + return $items; +} + +/** + * Drush Provision Reinstall task callback. + * + * Invokes Provision Delete and Install tasks to simulate a site reinstall. + */ +function drush_provision_site_reinstall_provision_reinstall() { + // Preserve our existing Aegir site context data, since it gets deleted along + // with ths site. + $alias_name = d()->name; + $options = provision_sitealias_get_record($alias_name); + + provision_backend_invoke($alias_name, "provision-delete"); + + // Recreate our Aegir site context. + provision_backend_invoke("@hostmaster", "provision-save", array($alias_name), $options); + + provision_backend_invoke($alias_name, "provision-install"); +} diff --git a/hosting_reinstall/hosting.feature.reinstall.inc b/hosting_reinstall/hosting.feature.reinstall.inc new file mode 100644 index 0000000..e7ce30f --- /dev/null +++ b/hosting_reinstall/hosting.feature.reinstall.inc @@ -0,0 +1,22 @@ + t('Site reinstall'), + 'description' => t('Provides a Hosting task to reinstall sites.'), + 'status' => HOSTING_FEATURE_DISABLED, + 'module' => 'hosting_site_reinstall', + 'group' => 'experimental', + ); + + return $features; +} diff --git a/hosting_reinstall/hosting_site_reinstall.info b/hosting_reinstall/hosting_site_reinstall.info new file mode 100644 index 0000000..defeea5 --- /dev/null +++ b/hosting_reinstall/hosting_site_reinstall.info @@ -0,0 +1,5 @@ +name = Hosting Reinstall +description = Provides a Hosting task to reinstall sites. +package = Hosting Development Tools +dependencies[] = hosting_site +core = 7.x diff --git a/hosting_reinstall/hosting_site_reinstall.module b/hosting_reinstall/hosting_site_reinstall.module new file mode 100644 index 0000000..e52f94b --- /dev/null +++ b/hosting_reinstall/hosting_site_reinstall.module @@ -0,0 +1,20 @@ + t('Reinstall'), + 'description' => t('Reinstall the site.'), + 'dialog' => TRUE, + ); + + return $tasks; +}