You are here

function hosting_context_load in Hostmaster (Aegir) 6

Get the node associated with a given provision context.

Parameters

$name: The name of the context to load.

Return value

Either the node object associated with the context, or FALSE if no associated node can be found.

3 calls to hosting_context_load()
drush_hosting_resume in modules/hosting/resume.hosting.inc
Drush command to resume the Aegir frontend site.
drush_hosting_task_validate in modules/hosting/task.hosting.inc
Validate hook for the hosting-task Drush command.
hosting_drush_import in modules/hosting/hosting.drush.inc
Imports a drush named context / "site alias" into the hostmaster front end, by creating nodes and translating the value.

File

modules/hosting/hosting.module, line 795
Hosting module.

Code

function hosting_context_load($name) {
  $name = ltrim($name, '@');

  // TODO : introduce static caching ?
  $result = db_query("SELECT nid FROM {hosting_context} WHERE name='%s'", $name);
  if ($obj = db_fetch_object($result)) {
    return node_load($obj->nid);
  }
  return FALSE;
}