]> git.mxchange.org Git - friendica.git/blobdiff - update.php
Added "blocked" fields
[friendica.git] / update.php
index 52b2494b211aab4b4c5bc81b843dc08dd9c36f55..b5d17848941bfa18994dc445454c910a72f2c799 100644 (file)
@@ -50,6 +50,7 @@ use Friendica\Database\DBStructure;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
+use Friendica\Model\Notify;
 use Friendica\Model\Photo;
 use Friendica\Model\User;
 use Friendica\Model\Storage;
@@ -830,6 +831,18 @@ function pre_update_1377()
                return Update::FAILED;
        }
 
+       if (DBStructure::existsTable('diaspora-interaction') && !DBA::e("DELETE FROM `diaspora-interaction` WHERE `uri-id` NOT IN (SELECT `id` FROM `item-uri`)")) {
+               return Update::FAILED;
+       }
+
+       if (DBStructure::existsTable('item-activity') && !DBA::e("DELETE FROM `item-activity` WHERE `uri-id` NOT IN (SELECT `id` FROM `item-uri`)")) {
+               return Update::FAILED;
+       }
+
+       if (DBStructure::existsTable('item-content') && !DBA::e("DELETE FROM `item-content` WHERE `uri-id` NOT IN (SELECT `id` FROM `item-uri`)")) {
+               return Update::FAILED;
+       }
+
        if (!DBA::e("DELETE FROM `notify` WHERE `uri-id` NOT IN (SELECT `id` FROM `item-uri`)")) {
                return Update::FAILED;
        }
@@ -837,7 +850,6 @@ function pre_update_1377()
        if (!DBA::e("UPDATE `notify` SET `parent-uri-id` = NULL WHERE `parent-uri-id` = 0")) {
                return Update::FAILED;
        }
-
        if (!DBA::e("DELETE FROM `notify` WHERE `parent-uri-id` NOT IN (SELECT `id` FROM `item-uri`)")) {
                return Update::FAILED;
        }
@@ -856,3 +868,18 @@ function pre_update_1377()
 
        return Update::SUCCESS;
 }
+
+function update_1380()
+{
+       if (!DBA::e("UPDATE `notify` INNER JOIN `item` ON `item`.`id` = `notify`.`iid` SET `notify`.`uri-id` = `item`.`uri-id` WHERE `notify`.`uri-id` IS NULL AND `notify`.`otype` IN (?, ?)",
+               Notify\ObjectType::ITEM, Notify\ObjectType::PERSON)) {
+               return Update::FAILED;
+       }
+
+       if (!DBA::e("UPDATE `notify` INNER JOIN `item` ON `item`.`id` = `notify`.`parent` SET `notify`.`parent-uri-id` = `item`.`uri-id` WHERE `notify`.`parent-uri-id` IS NULL AND `notify`.`otype` IN (?, ?)",
+               Notify\ObjectType::ITEM, Notify\ObjectType::PERSON)) {
+               return Update::FAILED;
+       }
+
+       return Update::SUCCESS;
+}