Use the "abandon days" for the user language detection

This commit is contained in:
Michael 2023-11-05 21:04:29 +00:00
parent 9e47cde90c
commit f5091110c2
1 changed files with 8 additions and 1 deletions

View File

@ -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']);