From f7672771e05742054f41d5b32e4d053105643720 Mon Sep 17 00:00:00 2001 From: jwed Date: Sat, 23 May 2026 15:26:50 -0400 Subject: [PATCH] refactor: read timezone from shell-level site_timezone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- src/Console/RotatePasswords.php | 2 +- src/Console/SyncPpskSchedules.php | 2 +- src/Http/Controllers/UnifiSettingsController.php | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Console/RotatePasswords.php b/src/Console/RotatePasswords.php index bdc1577..e9b75d7 100644 --- a/src/Console/RotatePasswords.php +++ b/src/Console/RotatePasswords.php @@ -81,7 +81,7 @@ class RotatePasswords extends Command $hour = (int) Setting::get('unifi.password_rotation.hour', 2); $minute = (int) Setting::get('unifi.password_rotation.minute', 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); if ($now->hour !== $hour || $now->minute !== $minute) { diff --git a/src/Console/SyncPpskSchedules.php b/src/Console/SyncPpskSchedules.php index c8c7bca..d8a6fdf 100644 --- a/src/Console/SyncPpskSchedules.php +++ b/src/Console/SyncPpskSchedules.php @@ -18,7 +18,7 @@ class SyncPpskSchedules extends Command return self::SUCCESS; } - $tz = Setting::get('unifi.timezone', 'UTC'); + $tz = \App\Support\Timezone::current(); $now = now($tz); $day = $now->dayOfWeek; // 0=Sun … 6=Sat $slot = $now->hour * 2 + ($now->minute >= 30 ? 1 : 0); // 0–47 diff --git a/src/Http/Controllers/UnifiSettingsController.php b/src/Http/Controllers/UnifiSettingsController.php index 979bea7..a24f281 100644 --- a/src/Http/Controllers/UnifiSettingsController.php +++ b/src/Http/Controllers/UnifiSettingsController.php @@ -19,7 +19,6 @@ class UnifiSettingsController extends Controller 'pollInterval' => (int) Setting::get('unifi.poll_interval', 30), 'cacheTtl' => (int) Setting::get('unifi.cache_ttl', 30), 'retentionDays' => (int) Setting::get('unifi.retention_days', 30), - 'timezone' => Setting::get('unifi.timezone', 'UTC'), 'autoRebootEnabled' => (bool) Setting::get('unifi.auto_reboot.enabled', false), 'autoRebootFrequency' => Setting::get('unifi.auto_reboot.frequency', 'daily'), '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', 'cache_ttl' => 'nullable|integer|min:5|max:300', 'retention_days' => 'nullable|integer|min:1|max:365', - 'timezone' => 'nullable|string|timezone', 'auto_reboot_enabled' => 'boolean', 'auto_reboot_frequency' => 'in:daily,weekly', '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('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('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.frequency', $request->input('auto_reboot_frequency', 'daily'));