function hostmaster_get_task in Hostmaster (Aegir) 5.x
1 call to hostmaster_get_task()
File
- ./
hostmaster.profile, line 50
Code
function hostmaster_get_task($task, $offset = 0) {
static $tasks;
static $keys;
if (!$tasks) {
$tasks = hostmaster_profile_task_list();
$keys = array_keys($tasks);
}
if ($task == $keys[sizeof($keys) - 1] && $offset > 0) {
return 'profile-finished';
}
// finish if the task is the last one and the offset is positive
if (($tid = array_search($task, $keys)) === FALSE) {
// at beginning
$tid = 0;
}
$tid = $tid + $offset;
// reset to beginning if it tries to go back too far
if ($tid < 0) {
$tid = 0;
}
return $keys[$tid];
}