]> git.mxchange.org Git - friendica.git/blobdiff - update.php
Adapt ProfileField & Fix current PermissionSet Usage at ProfileFields
[friendica.git] / update.php
index 536610a00e42304e5a9fbf1dc1725005ef79f842..f5d3108300a916420794aac8f54306af669e4f83 100644 (file)
@@ -192,8 +192,8 @@ function update_1330()
        }
 
        // Update attachments and photos
-       if (!DBA::p("UPDATE `photo` SET `photo`.`backend-class` = SUBSTR(`photo`.`backend-class`, 25) WHERE `photo`.`backend-class` LIKE 'Friendica\\\Model\\\Storage\\\%' ESCAPE '|'") ||
-           !DBA::p("UPDATE `attach` SET `attach`.`backend-class` = SUBSTR(`attach`.`backend-class`, 25) WHERE `attach`.`backend-class` LIKE 'Friendica\\\Model\\\Storage\\\%' ESCAPE '|'")) {
+       if (!DBA::e("UPDATE `photo` SET `photo`.`backend-class` = SUBSTR(`photo`.`backend-class`, 25) WHERE `photo`.`backend-class` LIKE 'Friendica\\\Model\\\Storage\\\%' ESCAPE '|'") ||
+           !DBA::e("UPDATE `attach` SET `attach`.`backend-class` = SUBSTR(`attach`.`backend-class`, 25) WHERE `attach`.`backend-class` LIKE 'Friendica\\\Model\\\Storage\\\%' ESCAPE '|'")) {
                return Update::FAILED;
        };
 
@@ -206,7 +206,7 @@ function update_1332()
        $profiles = DBA::select('profile', [], $condition);
 
        while ($profile = DBA::fetch($profiles)) {
-               DI::profileField()->migrateFromLegacyProfile($profile);
+               Profile::migrate($profile);
        }
        DBA::close($profiles);
 
@@ -998,3 +998,33 @@ function update_1434()
 
        return Update::SUCCESS;
 }
+
+function update_1435()
+{
+       $contacts = DBA::select('contact', [], ["`uid` != ?", 0]);
+       while ($contact = DBA::fetch($contacts)) {
+               Contact\User::insertForContactArray($contact);
+       }
+}
+
+function update_1438()
+{
+       DBA::update('photo', ['photo-type' => Photo::USER_AVATAR], ['profile' => true]);
+       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);
+}