duplicate confirmation to avoid where clause

darcs-hash:20080913164333-84dde-ef4f3363e045aabd52173ea9be34b2f59f64d084.gz
This commit is contained in:
Evan Prodromou 2008-09-13 12:43:33 -04:00
parent ed57778b92
commit e84439d5c5
1 changed files with 12 additions and 5 deletions

View File

@ -66,15 +66,22 @@ class XmppConfirmHandler extends XmppQueueHandler {
continue; continue;
} else { } else {
$this->log(LOG_INFO, 'Confirmation sent for ' . $confirm->address); $this->log(LOG_INFO, 'Confirmation sent for ' . $confirm->address);
# Mark confirmation sent # Mark confirmation sent; need a dupe so we don't have the WHERE clause
$original = clone($confirm); $dupe = Confirm_address::staticGet('code', $confirm->code);
$confirm->sent = $confirm->claimed; if (!$dupe) {
$result = $confirm->update($original); common_log(LOG_WARNING, 'Could not refetch confirm', __FILE__);
continue;
}
$orig = clone($dupe);
$dupe->sent = $dupe->claimed;
$result = $dupe->update($orig);
if (!$result) { if (!$result) {
common_log_db_error($confirm, 'UPDATE', __FILE__); common_log_db_error($dupe, 'UPDATE', __FILE__);
# Just let the claim age out; hopefully things work then # Just let the claim age out; hopefully things work then
continue; continue;
} }
$dupe->free();
unset($dupe);
} }
$user->free(); $user->free();
unset($user); unset($user);