Update user import/export with profile fields

- Account for backward compatibility when exporting: add values for profile.is-default and profile.profile-name fields
- Account for forward compatibility when importing: migrate legacy profiles to custom profile fields
This commit is contained in:
Hypolite Petovan 2020-01-22 19:36:20 -05:00
parent 18cfd8dfaa
commit e8bf74914b
2 changed files with 52 additions and 18 deletions

View file

@ -167,7 +167,11 @@ class UserExport extends BaseSettingsModule
$profile = self::exportMultiRow(
sprintf("SELECT * FROM `profile` WHERE `uid` = %d ", intval(local_user()))
sprintf("SELECT *, 'default' AS `profile_name`, 1 AS `is-default` FROM `profile` WHERE `uid` = %d ", intval(local_user()))
);
$profile_fields = self::exportMultiRow(
sprintf("SELECT * FROM `profile_field` WHERE `uid` = %d ", intval(local_user()))
);
$photo = self::exportMultiRow(
@ -196,6 +200,7 @@ class UserExport extends BaseSettingsModule
'user' => $user,
'contact' => $contact,
'profile' => $profile,
'profile_fields' => $profile_fields,
'photo' => $photo,
'pconfig' => $pconfig,
'group' => $group,