Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v7.0.1
- name: Set up Python
uses: actions/setup-python@v6.3.0
uses: actions/setup-python@v7.0.0
with:
python-version: "3.13"
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-and-analyse-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
- uses: actions/setup-python@v6.3.0
- uses: actions/setup-python@v7.0.0
with:
python-version: "3.13"
- run: pip install --upgrade tox
Expand Down
40 changes: 40 additions & 0 deletions Presenters/Admin/ManageConfigurationPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ public function Update()
}
}

if (!$isPluginConfig) {
$mergedSettings = $this->EnableIcsSubscriptionIfNeeded($mergedSettings);
}

Log::Debug('Saving %s settings', count($configSettings));

// WriteSettings will handle the proper nesting based on file type
Expand All @@ -242,6 +246,42 @@ public function SetHomepage()
ServiceLocator::GetDatabase()->Execute($command);
}

/**
* Generates and stores an ICS subscription key when the admin enables ICS
* through this settings page without setting a key, so subscription links
* do not remain broken until an unrelated schedule/resource/user toggle
* triggers key generation.
*
* @param array $mergedSettings
* @return array
*/
private function EnableIcsSubscriptionIfNeeded(array $mergedSettings): array
{
if (!isset($mergedSettings['ics']) || !is_array($mergedSettings['ics'])) {
return $mergedSettings;
}

if (ConfigKeys::hasEnv(ConfigKeys::ICS_SUBSCRIPTION_KEY)) {
return $mergedSettings;
}

$icsEnabled = filter_var(
$mergedSettings['ics']['enabled'] ?? ConfigKeys::ICS_ENABLED['default'],
FILTER_VALIDATE_BOOLEAN
);

$newKey = ConfigurationFile::GenerateSubscriptionKeyIfNeeded(
$icsEnabled,
$mergedSettings['ics']['subscription.key'] ?? ''
);

if ($newKey !== null) {
$mergedSettings['ics']['subscription.key'] = $newKey;
}

return $mergedSettings;
}

private function ShouldBeSkipped(string $key, ?ConfigKey $meta): bool
{
if ($meta === null) {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading