]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
duplicate confirmation to avoid where clause
authorEvan Prodromou <evan@prodromou.name>
Sat, 13 Sep 2008 16:43:33 +0000 (12:43 -0400)
committerEvan Prodromou <evan@prodromou.name>
Sat, 13 Sep 2008 16:43:33 +0000 (12:43 -0400)
darcs-hash:20080913164333-84dde-ef4f3363e045aabd52173ea9be34b2f59f64d084.gz

scripts/xmppconfirmhandler.php

index d1735d8d2e9a1fde29a03d6f0bf85321838e6a7b..8961b0b6e38f6a54a62cdc3782b79ae9a93dadae 100755 (executable)
@@ -66,15 +66,22 @@ class XmppConfirmHandler extends XmppQueueHandler {
                                        continue;
                                } else {
                                        $this->log(LOG_INFO, 'Confirmation sent for ' . $confirm->address);
-                                       # Mark confirmation sent
-                                       $original = clone($confirm);
-                                       $confirm->sent = $confirm->claimed;
-                                       $result = $confirm->update($original);
+                                       # Mark confirmation sent; need a dupe so we don't have the WHERE clause
+                                       $dupe = Confirm_address::staticGet('code', $confirm->code);
+                                       if (!$dupe) {
+                                               common_log(LOG_WARNING, 'Could not refetch confirm', __FILE__);
+                                               continue;
+                                       }
+                                       $orig = clone($dupe);
+                                       $dupe->sent = $dupe->claimed;
+                                       $result = $dupe->update($orig);
                                        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
                                                continue;
                                        }
+                                       $dupe->free();
+                                       unset($dupe);
                                }
                                $user->free();
                                unset($user);