function hosting_platform_update in Hosting 7.4
Same name and namespace in other branches
- 5 platform/hosting_platform.module \hosting_platform_update()
- 6.2 platform/hosting_platform.module \hosting_platform_update()
- 7.3 platform/hosting_platform.module \hosting_platform_update()
Implements hook_update().
As an existing node is being updated in the database, we need to do our own database updates.
File
- platform/
hosting_platform.module, line 592 - Platform node type definition.
Code
function hosting_platform_update($node) {
// If this is a new node or we're adding a new revision.
if (!empty($node->revision)) {
hosting_platform_insert($node);
}
else {
if ($node->platform_status == HOSTING_PLATFORM_DELETED) {
$node->no_verify = TRUE;
}
db_update('hosting_platform')
->fields(array(
'git_remote' => $node->git_remote,
'git_reference' => $node->git_reference,
'git_reset' => (int) $node->git_reset,
'git_root' => hosting_path_normalize($node->git_root),
'git_docroot' => $node->git_docroot,
'publish_path' => hosting_path_normalize($node->publish_path),
'makefile' => isset($node->makefile) ? $node->makefile : (isset($node->frommakefile['makefile']) ? $node->frommakefile['makefile'] : ''),
'web_server' => $node->web_server,
'verified' => $node->verified,
'status' => $node->platform_status,
'make_working_copy' => isset($node->frommakefile['make_working_copy']) ? $node->frommakefile['make_working_copy'] : $node->make_working_copy,
))
->condition('nid', $node->nid)
->execute();
}
// Trigger verify tasks for each enabled site.
if (empty($node->no_verify)) {
$sites = hosting_get_sites_by_status($node->nid, HOSTING_SITE_ENABLED);
foreach ($sites as $site_nid => $site) {
hosting_add_task($site->nid, 'verify');
}
// If no sites, just verify the platform.
if (empty($sites)) {
hosting_add_task($node->nid, 'verify');
}
}
}