- //send the administrators an e-mail
- $condition = ['email' => explode(",", str_replace(" ", "", Config::get('config', 'admin_email'))), 'parent-uid' => 0];
- $adminlist = DBA::select('user', ['uid', 'language', 'email'], $condition, ['order' => ['uid']]);
-
- if (DBA::isResult($adminlist)) {
- $sent = [];
-
- // every admin could had different language
- while ($admin = DBA::fetch($adminlist)) {
- if (in_array($admin['email'], $sent)) {
- continue;
- }
- $sent[] = $admin['email'];
-
- $lang = (($admin['language']) ? $admin['language'] : 'en');
- $l10n = L10n::withLang($lang);
-
- $preamble = Strings::deindent($l10n->t("
- The friendica database was successfully updated from %s to %s.",
- $from_build, $to_build));
-
- notification([
- 'uid' => $admin['uid'],
- 'type' => SYSTEM_EMAIL,
- 'to_email' => $admin['email'],
- 'subject' => DI::l10n()->t('[Friendica Notify] Database update'),
- 'preamble' => $preamble,
- 'body' => $preamble,
- 'language' => $lang]
- );
- }
+ foreach(User::getAdminListForEmailing(['uid', 'language', 'email']) as $admin) {
+ $l10n = DI::l10n()->withLang($admin['language'] ?: 'en');
+
+ $preamble = Strings::deindent($l10n->t('
+ The friendica database was successfully updated from %s to %s.',
+ $from_build, $to_build));
+
+ $email = DI::emailer()
+ ->newSystemMail()
+ ->withMessage($l10n->t('[Friendica Notify] Database update'), $preamble)
+ ->forUser($admin)
+ ->withRecipient($admin['email'])
+ ->build();
+ DI::emailer()->send($email);