X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=update.php;h=aa043468caa9e40ba64483ffba8a406c5fcd666f;hb=dbf9132ea61854d54b0b503a7b1fb3681e6bf864;hp=b8d357da229e87d4447f7afa0686b6f868478683;hpb=abcbbd2ec1247e4d144ac6500b383dafebe2f47d;p=friendica.git diff --git a/update.php b/update.php index b8d357da22..aa043468ca 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ $key], ['id' => $data['id']]); Logger::notice('Updated contact', ['action' => 'update', 'contact' => $data['id'], "$translateKey" => $key, 'was' => $data[$translateKey]]); - Worker::add(PRIORITY_LOW, 'ProfileUpdate', $data['id']); + Contact::updateSelfFromUserID($data['id']); + Profile::publishUpdate($data['id']); $success++; } } @@ -152,7 +155,9 @@ function update_1323() { $users = DBA::select('user', ['uid']); while ($user = DBA::fetch($users)) { - Contact::updateSelfFromUserID($user['uid']); + if (Contact::updateSelfFromUserID($user['uid'])) { + Profile::publishUpdate($user['uid']); + } } DBA::close($users); @@ -660,7 +665,7 @@ function update_1380() function pre_update_1395() { - if (DBStructure::existsTable('post-user') && !DBA::e("DROP TABLE `post-user`")) { + if (DBStructure::existsTable('post-user') && !DBStructure::existsColumn('post-user', ['id']) && !DBA::e("DROP TABLE `post-user`")) { return Update::FAILED; } return Update::SUCCESS; @@ -834,7 +839,7 @@ function update_1404() while ($task = DBA::fetch($tasks)) { $parameters = json_decode($task['parameter'], true); - if (in_array($parameters[0], [Delivery::MAIL, Delivery::SUGGESTION, Delivery::REMOVAL, Delivery::RELOCATION])) { + if (is_array($parameters) && count($parameters) && in_array($parameters[0], [Delivery::MAIL, Delivery::SUGGESTION, Delivery::REMOVAL, Delivery::RELOCATION])) { continue; } @@ -883,5 +888,60 @@ function update_1404() 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; } } + +function update_1419() +{ + $mails = DBA::select('mail', ['id', 'from-url', 'uri', 'parent-uri', 'guid'], [], ['order' => ['id']]); + while ($mail = DBA::fetch($mails)) { + $fields = []; + $fields['author-id'] = Contact::getIdForURL($mail['from-url'], 0, false); + if (empty($fields['author-id'])) { + continue; + } + + $fields['uri-id'] = ItemURI::insert(['uri' => $mail['uri'], 'guid' => $mail['guid']]); + $fields['parent-uri-id'] = ItemURI::getIdByURI($mail['parent-uri']); + + $reply = DBA::selectFirst('mail', ['uri', 'uri-id', 'guid'], ['parent-uri' => $mail['parent-uri'], 'reply' => false]); + if (!empty($reply)) { + $fields['thr-parent'] = $reply['uri']; + if (!empty($reply['uri-id'])) { + $fields['thr-parent-id'] = $reply['uri-id']; + } else { + $fields['thr-parent-id'] = ItemURI::insert(['uri' => $reply['uri'], 'guid' => $reply['guid']]); + } + } + + DBA::update('mail', $fields, ['id' => $mail['id']]); + } + return Update::SUCCESS; +}