X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=update.php;h=a2999ed5a566bcec3c98aac516930f71feb8eac5;hb=7fd202dbc93f9e0914067337cf3ea4163f066399;hp=114401334401e8c514e28a0985258fe6a9402397;hpb=13827edd2cb6632a13ca983fe8c47cf679eaf4dc;p=friendica.git diff --git a/update.php b/update.php index 1144013344..a2999ed5a5 100644 --- a/update.php +++ b/update.php @@ -55,6 +55,7 @@ use Friendica\Model\Photo; use Friendica\Model\Post; use Friendica\Model\Profile; use Friendica\Model\Storage; +use Friendica\Security\PermissionSet\Repository\PermissionSet; use Friendica\Worker\Delivery; // Post-update script of PR 5751 @@ -206,7 +207,7 @@ function update_1332() $profiles = DBA::select('profile', [], $condition); while ($profile = DBA::fetch($profiles)) { - DI::profileField()->migrateFromLegacyProfile($profile); + Profile::migrate($profile); } DBA::close($profiles); @@ -1013,3 +1014,50 @@ function update_1438() DBA::update('photo', ['photo-type' => Photo::CONTACT_AVATAR], ["NOT `profile` AND NOT `contact-id` IS NULL AND `contact-id` != ?", 0]); DBA::update('photo', ['photo-type' => Photo::DEFAULT], ["NOT `profile` AND (`contact-id` IS NULL OR `contact-id` = ?) AND `photo-type` IS NULL AND `album` != ?", 0, Photo::CONTACT_PHOTOS]); } + +function update_1439() +{ + $intros = DBA::select('intro', ['id', 'fid'], ["NOT `fid` IS NULL AND `fid` != ?", 0]); + while ($intro = DBA::fetch($intros)) { + $fcontact = DBA::selectFirst('fcontact', ['url'], ['id' => $intro['fid']]); + if (!empty($fcontact['url'])) { + $id = Contact::getIdForURL($fcontact['url']); + if (!empty($id)) { + DBA::update('intro',['suggest-cid' => $id], ['id' => $intro['id']]); + } + } + } + DBA::close($intros); +} + +function update_1440() +{ + // Fix wrong public permissionset + DBA::p("UPDATE `profile_field` SET `psid` = ? WHERE psid IN (SELECT `id` FROM `permissionset` WHERE `id` != ? AND `allow_cid` = '' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '')", PermissionSet::PUBLIC, PermissionSet::PUBLIC); + DBA::delete('permissionset', ["`id` != ? AND `allow_cid` = '' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = ''", PermissionSet::PUBLIC]); + + return Update::SUCCESS; +} + +function update_1441() +{ + $languages = DI::l10n()->getAvailableLanguages(); + + $albums = [Photo::PROFILE_PHOTOS]; + foreach ($languages as $language) { + $albums[] = DI::l10n()->withLang($language)->t(Photo::PROFILE_PHOTOS); + } + $albums = array_unique($albums); + + Photo::update(['photo-type' => Photo::USER_AVATAR], ['album' => $albums]); + + return Update::SUCCESS; +} + +function update_1442() +{ + // transform blocked intros into ignored intros + DBA::update('intro', ['ignore' => 1, 'blocked' => 0], ['blocked' => 1]); + + return Update::SUCCESS; +}