From: Hypolite Petovan Date: Mon, 12 Feb 2018 00:28:39 +0000 (-0500) Subject: Add dba::exists usages to UserImport::importAccount X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1d035ae2ae803bb05f32fb08373373652931d204;p=friendica.git Add dba::exists usages to UserImport::importAccount --- diff --git a/src/Core/UserImport.php b/src/Core/UserImport.php index ec6e6bb86c..051f99926e 100644 --- a/src/Core/UserImport.php +++ b/src/Core/UserImport.php @@ -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; }