summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2008-11-12 13:51:46 -0500
committerEvan Prodromou <evan@controlyourself.ca>2008-11-12 13:51:46 -0500
commit50caffec3d26fb50c006f59b52446b38cb223292 (patch)
treeec68de1bd8d5e7f6ef617fbf164c73b4886d0a86
parent74786b951c162f9d2f7fee8496644b381c46db9f (diff)
check for errors in fixup_inboxes
darcs-hash:20081112185146-5ed1f-fbef54f5eac30f26b999cd2347583f7d867535bf.gz
-rwxr-xr-xscripts/fixup_inboxes.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/fixup_inboxes.php b/scripts/fixup_inboxes.php
index 8436106ed..e78e9c7f5 100755
--- a/scripts/fixup_inboxes.php
+++ b/scripts/fixup_inboxes.php
@@ -42,11 +42,14 @@ $cnt = $user->find();
while ($user->fetch()) {
common_log(LOG_INFO, 'Updating inbox for user ' . $user->id);
$inbox = new Notice_inbox();
- $inbox->query('INSERT INTO notice_inbox (user_id, notice_id, created) ' .
- 'SELECT ' . $user->id . ', notice.id, notice.created ' .
- 'FROM subscription JOIN notice ON subscription.subscribed = notice.profile_id ' .
- 'WHERE subscription.subscriber = ' . $user->id . ' ' .
- 'AND notice.created >= subscription.created');
+ $result = $inbox->query('INSERT INTO notice_inbox (user_id, notice_id, created) ' .
+ 'SELECT ' . $user->id . ', notice.id, notice.created ' .
+ 'FROM subscription JOIN notice ON subscription.subscribed = notice.profile_id ' .
+ 'WHERE subscription.subscriber = ' . $user->id . ' ' .
+ 'AND notice.created >= subscription.created');
+ if (!$result) {
+ common_log_db_error($inbox, 'INSERT', __FILE__);
+ }
$inbox->free();
unset($inbox);
}