refactor: read timezone from shell-level site_timezone
Drops unifi.timezone from the settings form (now lives in Admin → Settings on the shell). Schedulers (PPSK sync, password rotation) now read \App\Support\Timezone::current() — same fallback chain as the rest of the platform. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -81,7 +81,7 @@ class RotatePasswords extends Command
|
|||||||
$hour = (int) Setting::get('unifi.password_rotation.hour', 2);
|
$hour = (int) Setting::get('unifi.password_rotation.hour', 2);
|
||||||
$minute = (int) Setting::get('unifi.password_rotation.minute', 0);
|
$minute = (int) Setting::get('unifi.password_rotation.minute', 0);
|
||||||
$dow = (int) Setting::get('unifi.password_rotation.day_of_week', 0);
|
$dow = (int) Setting::get('unifi.password_rotation.day_of_week', 0);
|
||||||
$tz = Setting::get('unifi.timezone', 'UTC');
|
$tz = \App\Support\Timezone::current();
|
||||||
$now = now($tz);
|
$now = now($tz);
|
||||||
|
|
||||||
if ($now->hour !== $hour || $now->minute !== $minute) {
|
if ($now->hour !== $hour || $now->minute !== $minute) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class SyncPpskSchedules extends Command
|
|||||||
return self::SUCCESS;
|
return self::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tz = Setting::get('unifi.timezone', 'UTC');
|
$tz = \App\Support\Timezone::current();
|
||||||
$now = now($tz);
|
$now = now($tz);
|
||||||
$day = $now->dayOfWeek; // 0=Sun … 6=Sat
|
$day = $now->dayOfWeek; // 0=Sun … 6=Sat
|
||||||
$slot = $now->hour * 2 + ($now->minute >= 30 ? 1 : 0); // 0–47
|
$slot = $now->hour * 2 + ($now->minute >= 30 ? 1 : 0); // 0–47
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ class UnifiSettingsController extends Controller
|
|||||||
'pollInterval' => (int) Setting::get('unifi.poll_interval', 30),
|
'pollInterval' => (int) Setting::get('unifi.poll_interval', 30),
|
||||||
'cacheTtl' => (int) Setting::get('unifi.cache_ttl', 30),
|
'cacheTtl' => (int) Setting::get('unifi.cache_ttl', 30),
|
||||||
'retentionDays' => (int) Setting::get('unifi.retention_days', 30),
|
'retentionDays' => (int) Setting::get('unifi.retention_days', 30),
|
||||||
'timezone' => Setting::get('unifi.timezone', 'UTC'),
|
|
||||||
'autoRebootEnabled' => (bool) Setting::get('unifi.auto_reboot.enabled', false),
|
'autoRebootEnabled' => (bool) Setting::get('unifi.auto_reboot.enabled', false),
|
||||||
'autoRebootFrequency' => Setting::get('unifi.auto_reboot.frequency', 'daily'),
|
'autoRebootFrequency' => Setting::get('unifi.auto_reboot.frequency', 'daily'),
|
||||||
'autoRebootDow' => (int) Setting::get('unifi.auto_reboot.day_of_week', 0),
|
'autoRebootDow' => (int) Setting::get('unifi.auto_reboot.day_of_week', 0),
|
||||||
@@ -45,7 +44,6 @@ class UnifiSettingsController extends Controller
|
|||||||
'poll_interval' => 'nullable|integer|min:5|max:300',
|
'poll_interval' => 'nullable|integer|min:5|max:300',
|
||||||
'cache_ttl' => 'nullable|integer|min:5|max:300',
|
'cache_ttl' => 'nullable|integer|min:5|max:300',
|
||||||
'retention_days' => 'nullable|integer|min:1|max:365',
|
'retention_days' => 'nullable|integer|min:1|max:365',
|
||||||
'timezone' => 'nullable|string|timezone',
|
|
||||||
'auto_reboot_enabled' => 'boolean',
|
'auto_reboot_enabled' => 'boolean',
|
||||||
'auto_reboot_frequency' => 'in:daily,weekly',
|
'auto_reboot_frequency' => 'in:daily,weekly',
|
||||||
'auto_reboot_dow' => 'nullable|integer|min:0|max:6',
|
'auto_reboot_dow' => 'nullable|integer|min:0|max:6',
|
||||||
@@ -70,7 +68,6 @@ class UnifiSettingsController extends Controller
|
|||||||
if ($request->has('poll_interval')) Setting::set('unifi.poll_interval', $request->poll_interval ?? 30);
|
if ($request->has('poll_interval')) Setting::set('unifi.poll_interval', $request->poll_interval ?? 30);
|
||||||
if ($request->has('cache_ttl')) Setting::set('unifi.cache_ttl', $request->cache_ttl ?? 30);
|
if ($request->has('cache_ttl')) Setting::set('unifi.cache_ttl', $request->cache_ttl ?? 30);
|
||||||
if ($request->has('retention_days')) Setting::set('unifi.retention_days', $request->retention_days ?? 30);
|
if ($request->has('retention_days')) Setting::set('unifi.retention_days', $request->retention_days ?? 30);
|
||||||
if ($request->has('timezone')) Setting::set('unifi.timezone', $request->timezone ?? 'UTC');
|
|
||||||
|
|
||||||
Setting::set('unifi.auto_reboot.enabled', $request->boolean('auto_reboot_enabled') ? '1' : '');
|
Setting::set('unifi.auto_reboot.enabled', $request->boolean('auto_reboot_enabled') ? '1' : '');
|
||||||
Setting::set('unifi.auto_reboot.frequency', $request->input('auto_reboot_frequency', 'daily'));
|
Setting::set('unifi.auto_reboot.frequency', $request->input('auto_reboot_frequency', 'daily'));
|
||||||
|
|||||||
Reference in New Issue
Block a user