You are here

function hosting_context_load in Hosting 7.4

Same name and namespace in other branches
  1. 6.2 hosting.module \hosting_context_load()
  2. 7.3 hosting.module \hosting_context_load()

Get the node associated with a given provision context.

Parameters

string $name: The name of the context to load.

Return value

bool|object Either the node object associated with the context, or FALSE if no

4 calls to hosting_context_load()
drush_hosting_resume in ./resume.hosting.inc
Drush command to resume the Aegir frontend site.
drush_hosting_task_validate in ./task.hosting.inc
Validate hook for the hosting-task Drush command.
hosting_drush_import in ./hosting.drush.inc
Imports a drush named context / "site alias" into the hostmaster frontend.
hosting_site_insert in site/hosting_site.nodeapi.inc
Implements hook_insert().

File

./hosting.module, line 1193
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 = :name", array(
    ':name' => $name,
  ));
  if ($obj = $result
    ->fetch()) {
    return node_load($obj->nid);
  }
  return FALSE;
}