function background_process_get_processes in Background Process 7
Same name and namespace in other branches
- 8 background_process.module \background_process_get_processes()
- 6 background_process.module \background_process_get_processes()
Get background process.
Parameters
int $status: (Optional) Get processes with the specified status.
Return value
array Background process objects
2 calls to background_process_get_processes()
- background_process_ass_auto_unlock in background_process_ass/
background_process_ass.module - Unlock locked processes that aren't really running.
- background_process_overview_page in ./
background_process.admin.inc - Overview of background processes.
File
- ./
background_process.module, line 809
Code
function background_process_get_processes($status = NULL) {
$old_db = db_set_active('background_process');
$result = db_select('background_process', 'bp')
->fields('bp', array(
'handle',
'callback',
'args',
'uid',
'token',
'service_host',
'start_stamp',
'exec_status',
));
if (isset($status)) {
$result = $result
->condition('bp.status', $status);
}
$result = $result
->execute();
$processes = array();
while ($process = $result
->fetchObject()) {
$process->args = unserialize($process->args);
$process->callback = unserialize($process->callback);
$process->start = $process->start_stamp;
$process->status = $process->exec_status;
$processes[] = $process;
}
db_set_active($old_db);
return $processes;
}