forked from GNUsocial/gnu-social
add some transaction voodoo to the insert for rememberme cookies
darcs-hash:20081209185424-84dde-d439346477811043ae471c5e68644b326b016713.gz
This commit is contained in:
parent
3909544f9e
commit
44a683bfab
@ -614,8 +614,14 @@ function common_rememberme($user=NULL) {
|
||||
}
|
||||
|
||||
$rm = new Remember_me();
|
||||
|
||||
$rm->code = common_good_rand(16);
|
||||
$rm->user_id = $user->id;
|
||||
|
||||
# Wrap the insert in some good ol' fashioned transaction code
|
||||
|
||||
$rm->query('BEGIN');
|
||||
|
||||
$result = $rm->insert();
|
||||
|
||||
if (!$result) {
|
||||
@ -624,6 +630,8 @@ function common_rememberme($user=NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$rm->query('COMMIT');
|
||||
|
||||
common_debug('Inserted rememberme record (' . $rm->code . ', ' . $rm->user_id . '); result = ' . $result . '.', __FILE__);
|
||||
|
||||
$cookieval = $rm->user_id . ':' . $rm->code;
|
||||
|
Loading…
Reference in New Issue
Block a user