diff --git a/api/v1/database/mastodon/accounts/search/mod.php b/api/v1/database/mastodon/accounts/search/mod.php index d882b26..900e64a 100644 --- a/api/v1/database/mastodon/accounts/search/mod.php +++ b/api/v1/database/mastodon/accounts/search/mod.php @@ -55,6 +55,7 @@ $sql_all = ' {newerThanNDays} a.suspended_at IS NULL ORDER BY a.updated_at DESC + {lastNActiveUsers} '; $instances = null; @@ -115,9 +116,20 @@ if (isset($_GET['no_statuses'])) else $sql_all = str_replace('{noStatusesWhere}', '', $sql_all); +$last_n_active = null; +if (isset($_GET['last_n_active'])) { + $last_n_active = intval($_GET['last_n_active']); + if ($last_n_active < 0) + $last_n_active = 1; +} +if ($last_n_active !== null) + $sql_all = str_replace('{lastNActiveUsers}', 'LIMIT '.intval($_GET['last_n_active']), $sql_all); +else $sql_all = str_replace('{lastNActiveUsers}', '', $sql_all); + + $only_cached = false; $cache = null; -if ($user_filter === 'local') +if ($user_filter === 'local' || ($last_n_active !== null && $last_n_active <= 5000)) $cache = 'ondemand,60'; else if ($user_filter === 'remote') { $cache = 'always,3600';