X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=update.php;h=819085f7ff2f5c6f1342d4f36c3a9e851997b039;hb=f6ca5dbcc0243f3a6b7fb040b233403bd4567ccb;hp=94029065b2f03a6dc534234cb3b317878c3525dc;hpb=e561cad844951d7711e92c96019698da70a47e02;p=friendica.git diff --git a/update.php b/update.php index 94029065b2..819085f7ff 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ ['notifier', 'delivery', 'apdelivery', 'done' => false]]); + while ($task = DBA::fetch($tasks)) { + $parameters = json_decode($task['parameter'], true); + + if (in_array($parameters[0], [Delivery::MAIL, Delivery::SUGGESTION, Delivery::REMOVAL, Delivery::RELOCATION])) { + continue; + } + + switch (strtolower($task['command'])) { + case 'notifier': + if (count($parameters) == 3) { + continue 2; + } + $item = DBA::selectFirst('item', ['uid', 'uri-id'], ['id' => $parameters[1]]); + if (!DBA::isResult($item)) { + continue 2; + } + + $parameters[1] = $item['uri-id']; + $parameters[2] = $item['uid']; + break; + case 'delivery': + if (count($parameters) == 4) { + continue 2; + } + $item = DBA::selectFirst('item', ['uid', 'uri-id'], ['id' => $parameters[1]]); + if (!DBA::isResult($item)) { + continue 2; + } + + $parameters[1] = $item['uri-id']; + $parameters[3] = $item['uid']; + break; + case 'apdelivery': + if (count($parameters) == 6) { + continue 2; + } + + if (empty($parameters[4])) { + $parameters[4] = []; + } + + $item = DBA::selectFirst('item', ['uri-id'], ['id' => $parameters[1]]); + if (!DBA::isResult($item)) { + continue 2; + } + + $parameters[5] = $item['uri-id']; + break; + default: + continue 2; + } + DBA::update('workerqueue', ['parameter' => json_encode($parameters)], ['id' => $task['id']]); + + return Update::SUCCESS; + } +} + +function update_1407() +{ + if (!DBA::e("UPDATE `post` SET `causer-id` = NULL WHERE `causer-id` = 0")) { + return Update::FAILED; + } + if (!DBA::e("UPDATE `post-user` SET `causer-id` = NULL WHERE `causer-id` = 0")) { + return Update::FAILED; + } + if (!DBA::e("UPDATE `post-thread` SET `causer-id` = NULL WHERE `causer-id` = 0")) { + return Update::FAILED; + } + if (!DBA::e("UPDATE `post-thread-user` SET `causer-id` = NULL WHERE `causer-id` = 0")) { + return Update::FAILED; + } + + return Update::SUCCESS; +} + +function update_1413() +{ + if (!DBA::e("UPDATE `post-user` SET `post-reason` = `post-type` WHERE `post-type` >= 64 and `post-type` <= 75")) { + return Update::FAILED; + } +}