Repository navigation
feat: move every setting under one guardCore config key - #18
Merged
Merged
Conversation
Closes #16 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E28c6iftj4hRmx55Uaaoxc Entire-Checkpoint: 01M69N0ZE0B6J1J7J0H777WB39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #16
Every setting now lives under one EspoCRM config param,
guardCore:enabledplus everything that 1.0.0 kept inguard, Redis settings included. Nothing the extension owns sits at the root next to other extensions' keys any more. The docs now saydata/config-internal.php, where EspoCRM stores and rewrites levelsystemparams. Version 1.1.0.Behavior
guardCoreis declared at levelsystem, likeguardEnabledandguard, so the Settings API never returns any of them.MiddlewarereadsguardCoreand throws loudly in three cases:guardCoreis not a map;enabledis not a bool;guardCoreand the old keys while either side says enabled.The disabled path still only reads config.
The old
guardEnabled/guardkeep working and log one deprecation warning when the guard is built.New
AfterInstall(runs on install and upgrade) moves the old keys intoguardCoreand removes them. It changes nothing in these cases:guardthat is not a map;data/config-override.phpordata/config-internal-override.php(EspoCRM never writes those, so they stay and keep working with the warning).On upgrade, EspoCRM uninstalls the old version with
skipAfterScript(Actions/Extension/Install.php:210-216), so the old uninstall script does not wipe the config.Fixed, also present in 1.0.0: before EspoCRM 9.3,
ConfigWriterremoves a levelsystemparam fromconfig-internal.phponly (ConfigWriter.phpat 9.0.0, lines 143-153). Uninstall therefore leftguardEnabledandguardindata/config.php, where they lose theirsystemlevel. Both scripts now set each key to null before removing it. That moves the key out ofconfig.phpon every EspoCRM version.Verification
make lint: exit 0, PHPStan level 8 no errors.REDIS_HOST=127.0.0.1 REDIS_PORT=6538 make local-teston EspoCRM stable (PHP 8.5.12) and on 9.0.0 (PHP 8.3.36):OK (84 tests, 214 assertions),COVERAGE: 100.00% lines (GATE: PASS), exit 0 on both.ConfigandConfigWriterin a scratch directory and assert the file contents. They cover keys inconfig.php, inconfig-internal.php, split across both, in an override file, a fresh install, a second run and the uninstall. Negative control on 9.0.0: without the set-before-remove line, 4 of 11 fail ("guardEnabled left in config.php").espocrm/espocrm:10.0.10-apacheandespocrm/espocrm:9.2.7:data/config.phpbefore the upgrade;guardCoreindata/config-internal.phpand no old key anywhere after it;pre-commit runon the 35 changed files: exit 0.mkdocs build --strict: exit 0.make extensionpluscheck-extension-zip.sh:zip ok: guard-core-1.1.0.zip, 438221 bytes, 206 entries, withscripts/AfterInstall.phpandscripts/AfterUninstall.phpin it.Not run: an upgrade test on a 9.0.x image (9.2.7 is the newest affected tag that exists).