X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=update.php;h=b5d17848941bfa18994dc445454c910a72f2c799;hb=4cc52cef6b84e02687be5e306ef333060dcc8f53;hp=52b2494b211aab4b4c5bc81b843dc08dd9c36f55;hpb=752a3772694428003f3b816862a076f4162b44c2;p=friendica.git diff --git a/update.php b/update.php index 52b2494b21..b5d1784894 100644 --- a/update.php +++ b/update.php @@ -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; +}