| 1 |
<?php
|
| 2 |
|
| 3 |
/**
|
| 4 |
* Clone command implementation
|
| 5 |
*
|
| 6 |
* This command when called will
|
| 7 |
* 1. Make a backup of the current site, before modifications are made.
|
| 8 |
* 2. Execute 'provision deploy' to build the new site using the backup of the old site.
|
| 9 |
*
|
| 10 |
*/
|
| 11 |
|
| 12 |
/**
|
| 13 |
* Make sure we have a valid site being cloned, and that the file being cloned from exists
|
| 14 |
*/
|
| 15 |
function drush_provision_drupal_provision_clone_validate($url = null, $new_url = null, $platform = null) {
|
| 16 |
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_SITE);
|
| 17 |
}
|
| 18 |
|
| 19 |
/**
|
| 20 |
* Make a backup before making any changes, and add extract the file we are restoring from
|
| 21 |
*/
|
| 22 |
function drush_provision_drupal_pre_provision_clone($url, $new_url, $platform = null) {
|
| 23 |
drush_invoke('provision backup', $url);
|
| 24 |
}
|
| 25 |
|
| 26 |
/**
|
| 27 |
* Remove the extracted site directory
|
| 28 |
*/
|
| 29 |
function drush_provision_drupal_pre_provision_clone_rollback($url, $new_url, $platform = null) {
|
| 30 |
$success = provision_path("unlink", drush_get_option('backup_file'), TRUE, dt('Removed unused clone site package'), dt('Could not remove unused clone site package'));
|
| 31 |
}
|
| 32 |
|
| 33 |
/**
|
| 34 |
* Switch the clone directories around now that we have the new db installed
|
| 35 |
*/
|
| 36 |
function drush_provision_drupal_provision_clone($url, $new_url, $platform = null) {
|
| 37 |
# note that we reset the aliases so they don't conflict with the original site
|
| 38 |
drush_backend_invoke('provision deploy', array($new_url, drush_get_option('backup_file'), 'root' => $platform, 'aliases' => array(),
|
| 39 |
'web_host' => drush_get_option('web_host'), 'web_ip' => drush_get_option('web_ip'),
|
| 40 |
'db_host' => drush_get_option('db_host')));
|
| 41 |
}
|