You are here

function hosting_context_nid in Hosting 7.4

Same name and namespace in other branches
  1. 7.3 hosting.module \hosting_context_nid()

Lookup the node ID for a hosting context name.

Parameters

object|string $alias: The name of the provision context to import.

Return value

int The node ID associated with the alias.

3 calls to hosting_context_nid()
hostingService_http_pack::context_import in web_pack/hosting_web_pack.service.inc
hosting_platform_drush_context_import in platform/hosting_platform.drush.inc
Implements hook_drush_context_import().
hosting_site_drush_context_import in site/hosting_site.drush.inc
Implements hook_drush_context_import().

File

./hosting.module, line 1291
Hosting module.

Code

function hosting_context_nid($alias) {
  $name = is_object($alias) ? $alias->name : $alias;
  $name = ltrim($name, '@');
  $result = db_query("SELECT nid FROM {hosting_context} WHERE name = :name", array(
    ':name' => $name,
  ));
  if ($obj = $result
    ->fetch()) {
    return $obj->nid;
  }
  else {
    return hosting_drush_import($alias);
  }
}