diff --git a/http/Provision/Service/http/cluster.php b/http/Provision/Service/http/cluster.php index ea16f599..3a33895c 100644 --- a/http/Provision/Service/http/cluster.php +++ b/http/Provision/Service/http/cluster.php @@ -3,12 +3,14 @@ class Provision_Service_http_cluster extends Provision_Service_http { static function option_documentation() { return array( - 'cluster_web_servers' => 'server with cluster: comma-separated list of web servers.' + 'cluster_web_servers' => 'server with cluster: comma-separated list of web servers.', + 'cluster_file_authority' => 'set if the cluster members have arranged to share files/ and private/ folders, and the hostmaster is not a cluster member.', ); } function init_server() { $this->server->setProperty('cluster_web_servers', array(), TRUE); + $this->server->setProperty('cluster_file_authority', FALSE); } function init_site() { @@ -67,6 +69,16 @@ class Provision_Service_http_cluster extends Provision_Service_http { } function fetch($path = NULL) { + if ($this->context->type == 'site' && $this->server->cluster_file_authority) { + if ($path == $this->context->site_path . '/files/' || $path == $this->context->site_path . '/private/') { + drush_log("Delegating fetch to first server in cluster"); + $servers = array_values($this->server->cluster_web_servers); + $target_server = reset($servers); + return d($target_server) + ->service('http', $this->context) + ->fetch($path); + } + } drush_log('Skipping fetch from remote server(s), since master is authoritative in cluster service.'); } diff --git a/platform/provision_drupal.drush.inc b/platform/provision_drupal.drush.inc index 23fb9f93..ba9c48b4 100644 --- a/platform/provision_drupal.drush.inc +++ b/platform/provision_drupal.drush.inc @@ -114,6 +114,12 @@ function provision_drupal_push_site($override_slave_authority = FALSE) { // Check whether we're hosted on a cluster, in which case, the master is // authoritative. $cluster = d()->platform->web_server->http_service_type == 'cluster' ? TRUE : FALSE; + if ($cluster) { + // Unless the cluster is specifically configured otherwise. + if (d()->platform->web_server->cluster_file_authority) { + $cluster = FALSE; + } + } $options = array(); if ($override_slave_authority || $cluster) { $exclude = NULL;