]> git.mxchange.org Git - friendica.git/commitdiff
Rearranged order of update calls
authorMichael <heluecht@pirati.ca>
Tue, 2 Feb 2021 06:05:50 +0000 (06:05 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 2 Feb 2021 06:05:50 +0000 (06:05 +0000)
update.php

index 698d043a3cec1ac84f2a30e805f51350b6cfc2bb..d5bfc5fe39c0a523dabf9510bcb6c531901fd93e 100644 (file)
@@ -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;
        }