function background_process_set_process in Background Process 7
Same name and namespace in other branches
- 8 background_process.module \background_process_set_process()
- 6 background_process.module \background_process_set_process()
Set background process.
@global object $user Current logged in user
Parameters
string $handle: Handle of background process
callback $callback: Function of background process
Return value
bool TRUE if set, FALSE if not
2 calls to background_process_set_process()
File
- ./
background_process.module, line 697
Code
function background_process_set_process($handle, $callback, $uid, $args, $token) {
// Setup parameters.
$args = serialize($args);
$callback = serialize($callback);
// Get user.
if (!isset($uid)) {
global $user;
$uid = $user->uid;
}
try {
$old_db = db_set_active('background_process');
$result = db_update('background_process')
->fields(array(
'callback' => $callback,
'args' => $args,
'uid' => $uid,
'token' => $token,
))
->condition('handle', $handle)
->execute();
db_set_active($old_db);
return $result;
} catch (Exception $e) {
db_set_active($old_db);
throw $e;
}
}