diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-11-13 17:03:35 -0500 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-11-13 17:03:35 -0500 |
commit | 7ac5b61814f7313b91e1b137daddfbf0ae709ffa (patch) | |
tree | 85948b6950725ecebfff7cab4f62db8d0c8ef648 | |
parent | 5409bd6a5d5768f912aacce764fe301caf46c5c6 (diff) |
update inboxed flag in fixup inboxes
darcs-hash:20081113220335-84dde-27009ae22f0994709046b6681d3139455a4e9c22.gz
-rwxr-xr-x | scripts/fixup_inboxes.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/scripts/fixup_inboxes.php b/scripts/fixup_inboxes.php index 93355e5ed..14a9f86d3 100755 --- a/scripts/fixup_inboxes.php +++ b/scripts/fixup_inboxes.php @@ -41,15 +41,25 @@ $cnt = $user->find(); while ($user->fetch()) { common_log(LOG_INFO, 'Updating inbox for user ' . $user->id); + $user->query('BEGIN'); $inbox = new Notice_inbox(); $result = $inbox->query('INSERT LOW_PRIORITY IGNORE 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) { + if (is_null($result) || $result === false) { common_log_db_error($inbox, 'INSERT', __FILE__); + continue; + } + $orig = clone($user); + $user->inboxed = 1; + $result = $user->update($orig); + if (!$result) { + common_log_db_error($user, 'UPDATE', __FILE__); + continue; } + $user->query('COMMIT'); $inbox->free(); unset($inbox); } |