function hosting_context_register in Hostmaster (Aegir) 6
Add a node to the context lookup db.
Parameters
$nid: The nid of the node to associate to the given provision context name.
$name: The name of the provision context.
8 calls to hosting_context_register()
- drush_hosting_resume in modules/
hosting/ resume.hosting.inc - Drush command to resume the Aegir frontend site.
- hosting_migrate_post_hosting_migrate_task in modules/
hosting/ migrate/ hosting_migrate.drush.inc - hosting_package_update_6004 in modules/
hosting/ package/ hosting_package.install - hosting_platform_insert in modules/
hosting/ platform/ hosting_platform.module - Implementation of hook_insert().
- hosting_platform_update_6004 in modules/
hosting/ platform/ hosting_platform.install
File
- modules/
hosting/ hosting.module, line 815 - Hosting module.
Code
function hosting_context_register($nid, $name) {
// Check first to see if this nid exists in the system. If so, update its name
$result = db_query("SELECT nid FROM {hosting_context} WHERE nid=%d", $nid);
if ($obj = db_fetch_object($result)) {
db_query("UPDATE {hosting_context} SET name = '%s' WHERE nid = %d", $name, $nid);
}
else {
// It's a new item
db_query("INSERT INTO {hosting_context} (nid, name) VALUES (%d, '%s')", $nid, $name);
}
// We include the file instead of enabling the module,
// because we do not want the overhead of having all the
// path UI stuff on nodes.
require_once "./modules/path/path.module";
path_set_alias("node/{$nid}", "hosting/c/{$name}");
}