fix deployment db issue and widthrawal administration page
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 47s
Tests / PHPUnit (push) Failing after 1m19s

This commit is contained in:
root
2026-08-20 20:18:00 -04:00
parent 889c037660
commit d3da699e55
19 changed files with 1170 additions and 194 deletions
+28 -2
View File
@@ -15,6 +15,11 @@ class TimeService
// Cached per-request user timezone
private ?string $cachedUserTz = null;
/** @var array<string, mixed>|null */
private ?array $cachedSettings = null;
private bool $settingsLookupAttempted = false;
/**
* Prime detection cache from the Request (optional call, lazy by default).
*/
@@ -76,13 +81,13 @@ class TimeService
// 3) Global settings timezone (if available)
try {
$settings = (new SettingsModel())->getSettings();
$settings = $this->cachedApplicationSettings();
$tz = $settings['timezone'] ?? null;
if ($tz && in_array($tz, timezone_identifiers_list(), true)) {
return $tz;
}
} catch (\Throwable $e) {
// ignore
// ignore — never fail the request for timezone lookup
}
// 4) School attendance timezone (if defined)
@@ -219,4 +224,25 @@ class TimeService
$value = trim($value);
return (bool) preg_match('/^\d{4}-\d{2}-\d{2}$/', $value);
}
/**
* @return array<string, mixed>
*/
private function cachedApplicationSettings(): array
{
if ($this->settingsLookupAttempted) {
return $this->cachedSettings ?? [];
}
$this->settingsLookupAttempted = true;
try {
$settings = (new SettingsModel())->getSettings();
$this->cachedSettings = is_array($settings) ? $settings : [];
} catch (\Throwable $e) {
$this->cachedSettings = [];
}
return $this->cachedSettings;
}
}