refactoring query

This commit is contained in:
Philipp Holzer 2018-10-29 11:33:27 +01:00
parent 9690dfc54e
commit e5530dfa63
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5

View file

@ -185,9 +185,7 @@ class Update
private static function updateFailed($update_id, $error_message) { private static function updateFailed($update_id, $error_message) {
//send the administrators an e-mail //send the administrators an e-mail
$admin_mail_list = "'".implode("','", array_map(['Friendica\Database\DBA', 'escape'], explode(",", str_replace(" ", "", Config::get('config', 'admin_email')))))."'"; $admin_mail_list = "'".implode("','", array_map(['Friendica\Database\DBA', 'escape'], explode(",", str_replace(" ", "", Config::get('config', 'admin_email')))))."'";
$adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)", $adminlist = DBA::select('user', ['uid', 'language', 'email'], ['`email` IN (%s)', $admin_mail_list]);
$admin_mail_list
);
// No valid result? // No valid result?
if (!DBA::isResult($adminlist)) { if (!DBA::isResult($adminlist)) {
@ -229,9 +227,7 @@ class Update
{ {
//send the administrators an e-mail //send the administrators an e-mail
$admin_mail_list = "'".implode("','", array_map(['Friendica\Database\DBA', 'escape'], explode(",", str_replace(" ", "", Config::get('config', 'admin_email')))))."'"; $admin_mail_list = "'".implode("','", array_map(['Friendica\Database\DBA', 'escape'], explode(",", str_replace(" ", "", Config::get('config', 'admin_email')))))."'";
$adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)", $adminlist = DBA::select('user', ['uid', 'language', 'email'], ['`email` IN (%s)', $admin_mail_list]);
$admin_mail_list
);
if (DBA::isResult($adminlist)) { if (DBA::isResult($adminlist)) {
// every admin could had different language // every admin could had different language
@ -256,6 +252,6 @@ class Update
} }
//try the logger //try the logger
logger("CRITICAL: Database structure update successful.", LOGGER_TRACE); logger("Database structure update successful.", LOGGER_TRACE);
} }
} }