X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=update.php;h=285252770a36090e3930655a299db8f43b2507d0;hb=974f7bffc82d024a38b4709c6b250677a217f65a;hp=c3c83b937b9116609e20dbb16761760fff3a5e00;hpb=303aaa00ca053fb65cfc7eec3bd5ce01825028e3;p=friendica.git diff --git a/update.php b/update.php index c3c83b937b..285252770a 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; @@ -802,10 +803,6 @@ function pre_update_1377() { DBStructure::checkInitialValues(); - if (!DBA::e("DELETE FROM `item` WHERE NOT `parent` IN (SELECT `id` FROM `item`)")) { - return Update::FAILED; - } - if (!DBA::e("DELETE FROM `item` WHERE NOT `author-id` IN (SELECT `id` FROM `contact`)")) { return Update::FAILED; } @@ -860,3 +857,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; +}