summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Pugh2016-11-10 16:38:50 -0500
committerJon Pugh2016-11-10 16:38:50 -0500
commit07e9a9185ff2e0501ef16a292c7738d11b8a3e42 (patch)
tree0ec68d5ffd4ea727faa6222814d7945546ee9d2a
parente39364bab4345d78322f14ddbd4cb84747dd9970 (diff)
Issue #2826388: Move logic to a new function: provision_is_hostmaster_site().2826388-check-hostmaster
-rw-r--r--platform/migrate.provision.inc6
-rw-r--r--provision.inc11
2 files changed, 14 insertions, 3 deletions
diff --git a/platform/migrate.provision.inc b/platform/migrate.provision.inc
index bae2cdb..b3fec3a 100644
--- a/platform/migrate.provision.inc
+++ b/platform/migrate.provision.inc
@@ -80,7 +80,7 @@ function drush_provision_drupal_provision_migrate($platform, $new_name = NULL) {
// If the site is migrated between platforms and not just renamed,
// we should update the info collected about source and target platform first.
// Note that we have to exclude Hostmaster platform from this extra verify.
- if (!(d()->root == d('@hostmaster')->root && d()->uri == d('@hostmaster')->uri)) {
+ if (!provision_is_hostmaster_site()) {
if (!is_null(d($platform)->name) && (d($platform)->name != d()->platform->name)) {
provision_backend_invoke('@hostmaster', 'hosting-task', array(d()->platform->name, 'verify'), array('force' => TRUE));
sleep(5); // A small trick to avoid high load and race conditions.
@@ -136,7 +136,7 @@ function drush_provision_drupal_provision_migrate($platform, $new_name = NULL) {
}
else {
// We have to exclude Hostmaster site from any extra verify steps.
- if (!(d()->root == d('@hostmaster')->root && d()->uri == d('@hostmaster')->uri)) {
+ if (!provision_is_hostmaster_site()) {
// We should update also the info collected about the site before running migrate task.
// Doing this is safe only when the site is migrated with the same name - see issue #1067702.
$local_uri_verify = '@' . d()->uri;
@@ -219,7 +219,7 @@ function drush_provision_drupal_post_provision_migrate($platform, $new_name = NU
$rename_only = drush_get_option('rename_only');
if ($rename_only) {
// We run this extra tricky backend verify to avoid issue #1004526.
- if (!(d()->root == d('@hostmaster')->root && d()->uri == d('@hostmaster')->uri)) {
+ if (!provision_is_hostmaster_site()) {
$deploy_replace_site = drush_get_option('deploy_replace_site');
$final_aliases = drush_get_option('aliases');
provision_reload_config('site', drush_get_option('new_site_path', d($new_name)->site_path) . '/drushrc.php');
diff --git a/provision.inc b/provision.inc
index 2c558fc..fe9c73f 100644
--- a/provision.inc
+++ b/provision.inc
@@ -132,6 +132,17 @@ function provision_is_local_host($host) {
}
/**
+ * Determine if the currently acting context is the server's hostmaster site.
+ *
+ * @return
+ * Boolean TRUE if the current drush context is "@hostmaster".
+ */
+function provision_is_hostmaster_site() {
+ // If the current root and URI matches "@hostmaster" root and URI, this is hostmaster.
+ return d()->root == d('@hostmaster')->root && d()->uri == d('@hostmaster')->uri;
+}
+
+/**
* return the FQDN of the machine or provided host
*
* this replicates hostname -f, which is not portable