]> git.mxchange.org Git - friendica.git/commitdiff
Use the "abandon days" for the user language detection
authorMichael <heluecht@pirati.ca>
Sun, 5 Nov 2023 21:04:29 +0000 (21:04 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 5 Nov 2023 21:04:29 +0000 (21:04 +0000)
src/Model/User.php

index 88194c6d01cb67f01d0b98af21f2947821e35337..3368d42bd950e52ff488a7693d6d414590a4fb0f 100644 (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']);