diff --git a/web_cluster/hosting_web_cluster.service.inc b/web_cluster/hosting_web_cluster.service.inc index f6ed625..8061dc1 100644 --- a/web_cluster/hosting_web_cluster.service.inc +++ b/web_cluster/hosting_web_cluster.service.inc @@ -16,6 +16,13 @@ class hostingService_http_cluster extends hostingService_http { '#title' => t('Web servers'), '#markup' => theme('item_list', array('items' => array_map('_hosting_node_link', array_intersect_key($this->web_servers, hosting_get_servers('http'))))), ); + if ($this->cluster_file_authority) { + $render['cluster_file_authority'] = [ + '#type' => 'item', + '#title' => t('Site files authority is cluster'), + '#markup' => t('Yes'), + ]; + } } function form(&$form) { @@ -32,6 +39,13 @@ class hostingService_http_cluster extends hostingService_http { '#options' => $servers, '#default_value' => isset($this->web_servers) ? $this->web_servers : array(), ); + + $form['cluster_file_authority'] = array( + '#title' => t('Site files authority is cluster'), + '#description' => t('Delegates files/ and private/ folder authority to the cluster itself. Only select this option if you have arranged for synchronization of the files/ and private/ folder among all cluster members, and the hostmaster is NOT a cluster member.'), + '#type' => 'checkbox', + '#default_value' => isset($this->cluster_file_authority) ? $this->cluster_file_authority : FALSE, + ); } function load() { @@ -46,9 +60,10 @@ class hostingService_http_cluster extends hostingService_http { $server = node_load($web_server->web_server_nid); $ssl_enabled = $ssl_enabled && $server->services['http']->ssl_enabled; } + $cluster_file_authority = variable_get('cluster_file_authority_' . $this->server->nid, FALSE); $this->ssl_enabled = $ssl_enabled; - $this->setValues(array('web_servers' => drupal_map_assoc($web_servers))); + $this->setValues(array('web_servers' => drupal_map_assoc($web_servers), 'cluster_file_authority' => $cluster_file_authority)); } function insert() { @@ -61,6 +76,7 @@ class hostingService_http_cluster extends hostingService_http { ); drupal_write_record('hosting_web_cluster', $record); } + variable_set('cluster_file_authority_' . $this->server->nid, $this->cluster_file_authority); } function delete() { @@ -68,6 +84,7 @@ class hostingService_http_cluster extends hostingService_http { db_delete('hosting_web_cluster') ->condition('nid', $this->server->nid) ->execute(); + variable_del('cluster_file_authority_' . $this->server->nid); } function delete_revision() { @@ -81,5 +98,6 @@ class hostingService_http_cluster extends hostingService_http { parent::context_options($task_type, $ref_type, $task); $task->context_options['cluster_web_servers'] = implode(',', array_values(array_map('hosting_context_name', array_intersect_key($this->web_servers, hosting_get_servers('http'))))); + $task->context_options['cluster_file_authority'] = $this->cluster_file_authority; } }