function hosting_hosting_server_context_options in Hosting 7.4
Same name and namespace in other branches
- 6.2 server/hosting_server.drush.inc \hosting_hosting_server_context_options()
- 7.3 server/hosting_server.drush.inc \hosting_hosting_server_context_options()
Pass options for the server verification to the backend.
Here we pass the hostname, IP addresses, and setup the services for this server (?).
File
- server/
hosting_server.drush.inc, line 13 - :Drush hooks for the Hosting server module.
Code
function hosting_hosting_server_context_options(&$task) {
$task->context_options['remote_host'] = $task->ref->title;
$ip_list = $task->ref->ip_addresses;
$task->context_options['ip_addresses'] = count($ip_list) ? implode(',', $ip_list) : 'null';
foreach (hosting_server_services() as $type => $info) {
if (isset($task->ref->services[$type])) {
$service = $task->ref->services[$type];
if ($service->available) {
$service
->context_options($task->task_type, $task->ref->type, $task);
}
}
else {
// If we're here, there is no enabled service of this type on this server.
// If such a service had previously been enabled, that fact, along with
// any subscribed properties would be recorded in the server context.
// Since we persist values in contexts, we cannot just leave this unset.
// Similarly, in Provision_Context::__get(), we filter out falsy values,
// so we cannot set this to NULL. 0 or the like. Therefore, we explicitely
// set it to value that we check for in
// Provision_Context_server::spawn_service().
$task->context_options["{$type}_service_type"] = 'NONE';
}
}
}