Commit 992e0764 authored by drumm's avatar drumm Committed by Neil Drumm

Clusters need ports.

parent 1c220b88
......@@ -40,6 +40,7 @@ class hostingService_http_cluster extends hostingService_http {
function insert() {
parent::insert();
$ports = array();
foreach (array_filter($this->web_servers) as $web_server) {
$record = array(
'nid' => $this->server->nid,
......@@ -47,17 +48,27 @@ class hostingService_http_cluster extends hostingService_http {
'web_server_nid' => $web_server,
);
drupal_write_record('hosting_web_cluster', $record);
$node = node_load($web_server);
$ports[] = explode(',', $node->services['http']->ports);
}
$record = array(
'nid' => $this->server->nid,
'vid' => $this->server->vid,
'ports' => implode(',', call_user_func_array('array_intersect', $ports)),
);
drupal_write_record('hosting_web_server', $record);
}
function delete() {
parent::delete();
db_query('DELETE FROM {hosting_web_cluster} WHERE nid = %d', $this->server->nid);
db_query('DELETE FROM {hosting_web_server} WHERE nid = %d', $this->server->nid);
}
function delete_revision() {
parent::delete_revision();
db_query('DELETE FROM {hosting_web_cluster} WHERE vid = %d', $this->server->vid);
db_query('DELETE FROM {hosting_web_server} WHERE vid = %d', $this->server->vid);
}
function context_options($task_type, $ref_type, &$task) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment