function hosting_get_most_recent_task in Hosting 7.4
Same name and namespace in other branches
- 5 task/hosting_task.module \hosting_get_most_recent_task()
- 6.2 task/hosting_task.module \hosting_get_most_recent_task()
- 7.3 task/hosting_task.module \hosting_get_most_recent_task()
Retrieve the latest task related to the specified platform, of a specific type.
This is used for documenting issues with verification.
File
- task/
hosting_task.module, line 1456 - Web server node type is defined here.
Code
function hosting_get_most_recent_task($rid, $type = null) {
$query = db_select('hosting_task', 'ht')
->fields('ht', [
'nid',
])
->condition('rid', $rid)
->orderBy('vid', 'DESC');
if ($type) {
$query
->condition('task_type', $type);
}
$nid = $query
->execute()
->fetchField();
if ($nid) {
return node_load($nid, NULL, TRUE);
}
}