You are here

function hook_hosting_TASK_OBJECT_context_options in Hostmaster (Aegir) 6

Add or change context options before a hosting task runs.

This hook is invoked just before any task that has the 'provision_save' flag equal to TRUE. These include the 'install', 'verify' and 'import' tasks.

The TASK_OBJECT will be either: 'server', 'platform' or 'site'.

This gives other modules the chance to send data to the backend to be persisted by services there. The entire task is sent so that you have access to it, but you should avoid changing things outside of the $task->content_options collection.

If you are sending extra context options to the backend based on properties in the object's node, then you should also implement the hook_drush_context_import() hook to re-create those properties on the node when a context is imported.

Parameters

$task: The hosting task that is about to be executed, the task is passed by reference. The context_options property of this object is about to be saved to the backend, so you can make any changes before that happens. Note that these changes won't persist in the backend unless you have a service that will store them.

The node representing the object of the task, e.g. the site that is being verified is available in the $task->ref property.

See also

drush_hosting_task()

hook_drush_context_import()

hook_hosting_tasks()

Related topics

4 functions implement hook_hosting_TASK_OBJECT_context_options()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

hosting_hosting_platform_context_options in modules/hosting/platform/hosting_platform.drush.inc
Implementation of hook_hosting_TASK_OBJECT_context_options().
hosting_hosting_server_context_options in modules/hosting/server/hosting_server.drush.inc
hosting_hosting_site_context_options in modules/hosting/site/hosting_site.drush.inc
hosting_ssl_hosting_site_context_options in modules/hosting/web_server/ssl/hosting_ssl.drush.inc

File

modules/hosting/hosting.api.php, line 169
Hooks provided by the hosting module, and some other random ones.

Code

function hook_hosting_TASK_OBJECT_context_options(&$task) {

  // From hosting_hosting_platform_context_options().
  $task->context_options['server'] = '@server_master';
  $task->context_options['web_server'] = hosting_context_name($task->ref->web_server);
}