Merge pull request #4439 from MrPetovan/bug/4396-use-dba-exists-in-uimport

Add dba::exists usages to UserImport::importAccount
This commit is contained in:
Michael Vogel 2018-02-12 06:02:30 +01:00 committed by GitHub
commit e90b3f606d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 20 deletions

View File

@ -112,27 +112,9 @@ class UserImport
}
// check for username
$r = dba::selectFirst('user', ['uid'], ['nickname' => $account['user']['nickname']]);
if ($r === false) {
logger("uimport:check nickname : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
notice(L10n::t('Error! Cannot check nickname'));
return;
}
if (DBM::is_result($r) > 0) {
notice(L10n::t("User '%s' already exists on this server!", $account['user']['nickname']));
return;
}
// check if username matches deleted account
$r = dba::selectFirst('userd', ['id'], ['username' => $account['user']['nickname']]);
if ($r === false) {
logger("uimport:check nickname : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
notice(L10n::t('Error! Cannot check nickname'));
return;
}
if (DBM::is_result($r) > 0) {
if (dba::exists('user', ['nickname' => $account['user']['nickname']])
|| dba::exists('userd', ['nickname' => $account['user']['nickname']])) {
notice(L10n::t("User '%s' already exists on this server!", $account['user']['nickname']));
return;
}