From 9f37a4d9a09d93acd6ac5fa5b8efd49b7470384e Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 2 Feb 2021 06:05:50 +0000 Subject: [PATCH] Rearranged order of update calls --- update.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/update.php b/update.php index 698d043a3c..d5bfc5fe39 100644 --- a/update.php +++ b/update.php @@ -717,15 +717,14 @@ function update_1396() function update_1397() { - if (!DBStructure::existsTable('thread') || !DBStructure::existsTable('user-item')) { - return Update::SUCCESS; + if (!DBA::e("INSERT INTO `post-user-notification`(`uri-id`, `uid`, `notification-type`) + SELECT `uri-id`, `uid`, `notification-type` FROM `post-user` WHERE `notification-type` != 0 + ON DUPLICATE KEY UPDATE `uri-id` = `post-user`.`uri-id`, `uid` = `post-user`.`uid`, `notification-type` = `post-user`.`notification-type`")) { + return Update::FAILED; } - if (!DBA::e("INSERT IGNORE INTO `post-thread-user`(`uri-id`, `uid`, `pinned`, `starred`, `ignored`, `wall`, `pubmail`, `forum_mode`) - SELECT `thread`.`uri-id`, `thread`.`uid`, `user-item`.`pinned`, `thread`.`starred`, - `thread`.`ignored`, `thread`.`wall`, `thread`.`pubmail`, `thread`.`forum_mode` - FROM `thread` LEFT JOIN `user-item` ON `user-item`.`iid` = `thread`.`iid`")) { - return Update::FAILED; + if (!DBStructure::existsTable('user-item')) { + return Update::SUCCESS; } if (!DBA::e("INSERT INTO `post-user-notification`(`uri-id`, `uid`, `notification-type`) @@ -735,9 +734,14 @@ function update_1397() return Update::FAILED; } - if (!DBA::e("INSERT IGNORE INTO `post-user-notification`(`uri-id`, `uid`, `notification-type`) - SELECT `uri-id`, `uid`, `notification-type` FROM `post-user` WHERE `notification-type` != 0 - ON DUPLICATE KEY UPDATE `uri-id` = `post-user`.`uri-id`, `uid` = `post-user`.`uid`, `notification-type` = `post-user`.`notification-type`")) { + if (!DBStructure::existsTable('thread')) { + return Update::SUCCESS; + } + + if (!DBA::e("INSERT IGNORE INTO `post-thread-user`(`uri-id`, `uid`, `pinned`, `starred`, `ignored`, `wall`, `pubmail`, `forum_mode`) + SELECT `thread`.`uri-id`, `thread`.`uid`, `user-item`.`pinned`, `thread`.`starred`, + `thread`.`ignored`, `thread`.`wall`, `thread`.`pubmail`, `thread`.`forum_mode` + FROM `thread` LEFT JOIN `user-item` ON `user-item`.`iid` = `thread`.`iid`")) { return Update::FAILED; } -- 2.39.5