From: Michael Date: Sun, 5 Nov 2023 21:04:29 +0000 (+0000) Subject: Use the "abandon days" for the user language detection X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f5091110c2f80d932b127facfb01a6762b50ec73;p=friendica.git Use the "abandon days" for the user language detection --- diff --git a/src/Model/User.php b/src/Model/User.php index 88194c6d01..3368d42bd9 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -586,7 +586,14 @@ class User $languages = []; $uids = []; - $users = DBA::select('user', ['uid', 'language'], ["`verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired` AND `uid` > ?", 0]); + $condition = ["`verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired` AND `uid` > ?", 0]; + + $abandon_days = intval(DI::config()->get('system', 'account_abandon_days')); + if (!empty($abandon_days)) { + $condition = DBA::mergeConditions($condition, ["`last-activity` > ?", DateTimeFormat::utc('now - ' . $abandon_days . ' days')]); + } + + $users = DBA::select('user', ['uid', 'language'], $condition); while ($user = DBA::fetch($users)) { $uids[] = $user['uid']; $code = DI::l10n()->toISO6391($user['language']);