asdas
All checks were successful
Deploy / deploy-staging (push) Successful in 6s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-05-11 01:57:23 +02:00
parent ebbdb52f93
commit 0f8f9567fe
6 changed files with 306 additions and 57 deletions

View File

@@ -306,6 +306,9 @@ final class ModuleCronScheduler
$job = $jobExists ? $jobs[$definition['name']] : [];
$timezoneSetting = trim((string) ($definition['timezone_setting'] ?? ''));
$fallbackTimezone = $timezoneSetting !== '' ? trim((string) ($settings[$timezoneSetting] ?? '')) : '';
if ($fallbackTimezone === '' && function_exists('nexus_cron_timezone_name')) {
$fallbackTimezone = trim((string) nexus_cron_timezone_name());
}
$defaultEntry = [
'enabled' => (bool) $definition['default_enabled'],
'cron_expression' => trim((string) ($definition['default_cron'] ?? '0 * * * *')),
@@ -336,7 +339,7 @@ final class ModuleCronScheduler
$result[] = [
'enabled' => array_key_exists('enabled', $entry) ? $this->settingBool($entry['enabled'], (bool) $defaultEntry['enabled']) : (bool) $defaultEntry['enabled'],
'cron_expression' => trim((string) ($entry['cron_expression'] ?? $defaultEntry['cron_expression'])),
'timezone' => trim((string) ($entry['timezone'] ?? $defaultEntry['timezone'])),
'timezone' => (($entryTimezone = trim((string) ($entry['timezone'] ?? ''))) !== '' ? $entryTimezone : $defaultEntry['timezone']),
'builder' => is_array($entry['builder'] ?? null) ? $entry['builder'] : [],
];
}

View File

@@ -336,6 +336,66 @@ function nexus_debug_clear(?string $source = null): void
}));
}
function nexus_settings(): array
{
try {
return modules()->settings('_nexus');
} catch (\Throwable) {
return [];
}
}
function nexus_save_settings(array $settings): void
{
modules()->saveSettings('_nexus', $settings);
}
function nexus_system_timezone_name(): string
{
$timezone = trim((string) date_default_timezone_get());
if ($timezone === '') {
return 'UTC';
}
try {
new \DateTimeZone($timezone);
return $timezone;
} catch (\Throwable) {
return 'UTC';
}
}
function nexus_display_timezone_name(): string
{
$settings = nexus_settings();
$useCustom = !empty($settings['display_timezone_custom']);
$timezone = trim((string) ($settings['display_timezone'] ?? ''));
if ($useCustom && $timezone !== '') {
try {
new \DateTimeZone($timezone);
return $timezone;
} catch (\Throwable) {
}
}
return nexus_system_timezone_name();
}
function nexus_cron_timezone_name(): string
{
$settings = nexus_settings();
$timezone = trim((string) ($settings['cron_timezone'] ?? ''));
if ($timezone !== '') {
try {
new \DateTimeZone($timezone);
return $timezone;
} catch (\Throwable) {
}
}
return nexus_display_timezone_name();
}
function module_debug_enabled(string $module): bool
{
if (preg_match('/[^a-zA-Z0-9_\-]/', $module)) {