function hosting_site_insert in Hosting 6.2
Same name and namespace in other branches
- 5 site/hosting_site.module \hosting_site_insert()
- 7.4 site/hosting_site.nodeapi.inc \hosting_site_insert()
- 7.3 site/hosting_site.nodeapi.inc \hosting_site_insert()
Implementation of hook_insert().
1 call to hosting_site_insert()
- hosting_site_update in site/
hosting_site.nodeapi.inc - Implementation of hook_update().
File
- site/
hosting_site.nodeapi.inc, line 145 - Site nodeapi implementations.
Code
function hosting_site_insert(&$node) {
$client = hosting_get_client($node->client);
$node->client = $client->nid;
$node->site_language = $node->site_language ? $node->site_language : 'en';
// If the cron_key is set use it, otherwise generate a new one.
$node->cron_key = !empty($node->cron_key) ? $node->cron_key : '';
// Ensure that the last_cron value is set.
$node->last_cron = isset($node->last_cron) ? $node->last_cron : 0;
db_query("INSERT INTO {hosting_site} (vid, nid, client, db_server, platform, profile, language, last_cron, cron_key, status, verified) VALUES (%d, %d, %d, %d, %d, %d, '%s', %d, '%s', %d, %d)", $node->vid, $node->nid, $node->client, $node->db_server, $node->platform, $node->profile, $node->site_language, $node->last_cron, $node->cron_key, $node->site_status, $node->verified);
if (empty($node->old_vid)) {
hosting_context_register($node->nid, $node->hosting_name ? $node->hosting_name : $node->title);
if ($node->import) {
hosting_add_task($node->nid, 'import');
}
else {
hosting_add_task($node->nid, 'install');
}
}
}