mirror of
https://github.com/friendica/friendica
synced 2024-11-14 04:22:55 +00:00
Merge pull request #3763 from annando/relocation-addr
Fixes the not changed "addr" entry when an account is imported
This commit is contained in:
commit
cc9074bed5
1 changed files with 7 additions and 3 deletions
|
@ -125,6 +125,10 @@ function import_account(App $a, $file) {
|
||||||
|
|
||||||
$oldbaseurl = $account['baseurl'];
|
$oldbaseurl = $account['baseurl'];
|
||||||
$newbaseurl = System::baseUrl();
|
$newbaseurl = System::baseUrl();
|
||||||
|
|
||||||
|
$oldaddr = str_replace('http://', '@', normalise_link($oldbaseurl));
|
||||||
|
$newaddr = str_replace('http://', '@', normalise_link($newbaseurl));
|
||||||
|
|
||||||
$olduid = $account['user']['uid'];
|
$olduid = $account['user']['uid'];
|
||||||
|
|
||||||
unset($account['user']['uid']);
|
unset($account['user']['uid']);
|
||||||
|
@ -133,7 +137,7 @@ function import_account(App $a, $file) {
|
||||||
unset($account['user']['expire_notification_sent']);
|
unset($account['user']['expire_notification_sent']);
|
||||||
|
|
||||||
foreach ($account['user'] as $k => &$v) {
|
foreach ($account['user'] as $k => &$v) {
|
||||||
$v = str_replace($oldbaseurl, $newbaseurl, $v);
|
$v = str_replace(array($oldbaseurl, $oldaddr), array($newbaseurl, $newaddr), $v);
|
||||||
}
|
}
|
||||||
|
|
||||||
// import user
|
// import user
|
||||||
|
@ -153,7 +157,7 @@ function import_account(App $a, $file) {
|
||||||
|
|
||||||
foreach ($account['profile'] as &$profile) {
|
foreach ($account['profile'] as &$profile) {
|
||||||
foreach ($profile as $k => &$v) {
|
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) {
|
foreach (array("profile", "avatar") as $k) {
|
||||||
$v = str_replace($oldbaseurl . "/photo/" . $k . "/" . $olduid . ".jpg", $newbaseurl . "/photo/" . $k . "/" . $newuid . ".jpg", $v);
|
$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) {
|
foreach ($account['contact'] as &$contact) {
|
||||||
if ($contact['uid'] == $olduid && $contact['self'] == '1') {
|
if ($contact['uid'] == $olduid && $contact['self'] == '1') {
|
||||||
foreach ($contact as $k => &$v) {
|
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) {
|
foreach (array("profile", "avatar", "micro") as $k) {
|
||||||
$v = str_replace($oldbaseurl . "/photo/" . $k . "/" . $olduid . ".jpg", $newbaseurl . "/photo/" . $k . "/" . $newuid . ".jpg", $v);
|
$v = str_replace($oldbaseurl . "/photo/" . $k . "/" . $olduid . ".jpg", $newbaseurl . "/photo/" . $k . "/" . $newuid . ".jpg", $v);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue