mirror of
https://github.com/friendica/friendica
synced 2024-12-22 03:57:32 +01:00
Check for user name in deleted user list and unset account expiration before importing the account (Bug #760)
This commit is contained in:
parent
a8345a555a
commit
7ab366b9c3
1 changed files with 15 additions and 1 deletions
|
@ -120,12 +120,26 @@ function import_account(&$a, $file) {
|
||||||
notice(sprintf(t("User '%s' already exists on this server!"), $account['user']['nickname']));
|
notice(sprintf(t("User '%s' already exists on this server!"), $account['user']['nickname']));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// check if username matches deleted account
|
||||||
|
$r = q("SELECT id FROM userd WHERE username='%s'", $account['user']['nickname']);
|
||||||
|
if ($r === false) {
|
||||||
|
logger("uimport:check nickname : ERROR : " . last_error(), LOGGER_NORMAL);
|
||||||
|
notice(t('Error! Cannot check nickname'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (count($r) > 0) {
|
||||||
|
notice(sprintf(t("User '%s' already exists on this server!"), $account['user']['nickname']));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$oldbaseurl = $account['baseurl'];
|
$oldbaseurl = $account['baseurl'];
|
||||||
$newbaseurl = $a->get_baseurl();
|
$newbaseurl = $a->get_baseurl();
|
||||||
$olduid = $account['user']['uid'];
|
$olduid = $account['user']['uid'];
|
||||||
|
|
||||||
unset($account['user']['uid']);
|
unset($account['user']['uid']);
|
||||||
|
unset($account['user']['account_expired']);
|
||||||
|
unset($account['user']['account_expires_on']);
|
||||||
|
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($oldbaseurl, $newbaseurl, $v);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue