mirror of
https://github.com/friendica/friendica
synced 2025-01-06 08:44:43 +00:00
Merge pull request #14390 from annando/issue-14381
Issue 14381: Fix automated register policy on first install
This commit is contained in:
commit
627fa95417
1 changed files with 3 additions and 2 deletions
|
@ -435,13 +435,14 @@ class Register extends BaseModule
|
||||||
}
|
}
|
||||||
public static function getPolicy(): int
|
public static function getPolicy(): int
|
||||||
{
|
{
|
||||||
|
$admins = User::getAdminList(['login_date']);
|
||||||
$days = DI::config()->get('system', 'admin_inactivity_limit');
|
$days = DI::config()->get('system', 'admin_inactivity_limit');
|
||||||
if ($days == 0) {
|
if ($days == 0 || empty($admins)) {
|
||||||
return intval(DI::config()->get('config', 'register_policy'));
|
return intval(DI::config()->get('config', 'register_policy'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$inactive_since = DateTimeFormat::utc('now - ' . $days . ' day');
|
$inactive_since = DateTimeFormat::utc('now - ' . $days . ' day');
|
||||||
foreach (User::getAdminList(['login_date']) as $admin) {
|
foreach ($admins as $admin) {
|
||||||
if (strtotime($admin['login_date']) > strtotime($inactive_since)) {
|
if (strtotime($admin['login_date']) > strtotime($inactive_since)) {
|
||||||
return intval(DI::config()->get('config', 'register_policy'));
|
return intval(DI::config()->get('config', 'register_policy'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue