Browse Source

Fixes the not changed "addr" entry when an account is imported

pull/3763/head
Michael 4 years ago
parent
commit
ceb0dda486
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      include/uimport.php

+ 7
- 3
include/uimport.php View File

@ -125,6 +125,10 @@ function import_account(App $a, $file) {
$oldbaseurl = $account['baseurl'];
$newbaseurl = System::baseUrl();
$oldaddr = str_replace('http://', '@', normalise_link($oldbaseurl));
$newaddr = str_replace('http://', '@', normalise_link($newbaseurl));
$olduid = $account['user']['uid'];
unset($account['user']['uid']);
@ -133,7 +137,7 @@ function import_account(App $a, $file) {
unset($account['user']['expire_notification_sent']);
foreach ($account['user'] as $k => &$v) {
$v = str_replace($oldbaseurl, $newbaseurl, $v);
$v = str_replace(array($oldbaseurl, $oldaddr), array($newbaseurl, $newaddr), $v);
}
// import user
@ -153,7 +157,7 @@ function import_account(App $a, $file) {
foreach ($account['profile'] as &$profile) {
foreach ($profile as $k => &$v) {
$v = str_replace($oldbaseurl, $newbaseurl, $v);
$v = str_replace(array($oldbaseurl, $oldaddr), array($newbaseurl, $newaddr), $v);
foreach (array("profile", "avatar") as $k) {
$v = str_replace($oldbaseurl . "/photo/" . $k . "/" . $olduid . ".jpg", $newbaseurl . "/photo/" . $k . "/" . $newuid . ".jpg", $v);
}
@ -172,7 +176,7 @@ function import_account(App $a, $file) {
foreach ($account['contact'] as &$contact) {
if ($contact['uid'] == $olduid && $contact['self'] == '1') {
foreach ($contact as $k => &$v) {
$v = str_replace($oldbaseurl, $newbaseurl, $v);
$v = str_replace(array($oldbaseurl, $oldaddr), array($newbaseurl, $newaddr), $v);
foreach (array("profile", "avatar", "micro") as $k) {
$v = str_replace($oldbaseurl . "/photo/" . $k . "/" . $olduid . ".jpg", $newbaseurl . "/photo/" . $k . "/" . $newuid . ".jpg", $v);
}


Loading…
Cancel
Save