Commit d917c81f authored by Adrian Rossouw's avatar Adrian Rossouw

@server_localhost was replaced by @server_master, and it now has the ability...

@server_localhost was replaced by @server_master, and it now has the ability to have a 'remote_host' other than localhost.
parent c74cdd9a
......@@ -64,8 +64,9 @@ function hostmaster_bootstrap() {
$node = new stdClass();
$node->uid = 1;
$node->type = 'server';
$node->title = 'localhost';
$node->title = d()->uri;
$node->status = 1;
$node->hosting_name = 'server_master';
$node->services = array();
......
......@@ -232,16 +232,16 @@ function hosting_update_6008() {
$records[$object->nid] = $object->title;
}
// We start with the web server because we assume that the main hostmaster site is installed locally.
$server_id = variable_get('hosting_own_web_server', 2);
db_query("UPDATE {node} SET title='localhost' WHERE nid=%d", $server_id);
db_query("UPDATE {node_revisions} SET title='localhost' WHERE nid=%d", $server_id);
$result = db_query("SELECT n.nid, title FROM {node} n LEFT JOIN {hosting_server} s ON n.nid=s.nid WHERE n.status = 1 AND n.type='server'");
while ($object = db_fetch_object($result)) {
$records[$object->nid] = 'server_' . preg_replace("/[!\W\.\-]/", "", $object->title);
}
// We start with the web server because we assume that the main hostmaster site is installed locally.
$server_id = variable_get('hosting_own_web_server', 2);
$records[$server_id] = 'server_master';
$result = db_query("SELECT nid, title FROM {node} WHERE type='platform'");
while ($object = db_fetch_object($result)) {
$records[$object->nid] = 'platform_' . preg_replace("/[!\W]/", "", $object->title);
......@@ -258,3 +258,23 @@ function hosting_update_6008() {
return $return;
}
/**
* Fix the reference to the master server so that it no longer points at localhost.
*/
function hosting_update_6009() {
// This undoes the change we made previously in update_6008, but can be run again.
$ret = array();
db_query("UPDATE {hosting_context} SET name='server_master' WHERE name='server_localhost'");
$server = hosting_context_load('@server_master');
$site = hosting_context_load('@hostmaster');
db_query("UPDATE {node} SET title='%s' WHERE nid=%d", $site->title, $server->nid);
db_query("UPDATE {node_revisions} SET title='%s' WHERE nid=%d", $site->title, $server->nid);
hosting_add_task($server->nid, 'verify');
return $ret;
}
......@@ -2,7 +2,7 @@
// $Id$
function hosting_platform_context_options(&$task) {
$task->context_options['server'] = '@server_localhost';
$task->context_options['server'] = '@server_master';
$task->context_options['web_server'] = hosting_context_name($task->ref->web_server);
$task->context_options['root'] = $task->ref->publish_path;
}
......
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