feat(setup): allow alternative context key instead of 'web'#16906
Open
Ibochkarev wants to merge 1 commit intomodxcms:3.xfrom
Open
feat(setup): allow alternative context key instead of 'web'#16906Ibochkarev wants to merge 1 commit intomodxcms:3.xfrom
Ibochkarev wants to merge 1 commit intomodxcms:3.xfrom
Conversation
- Add context_web_key option to CLI and web installer - Validate key: alphanumeric + underscore, forbid mgr/root - Write config.context.php for index.php context resolution - Rename web context in DB when custom key is used Resolves modxcms#14462
4bdf7e9 to
5e90445
Compare
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.
What does it do?
Adds support for specifying a custom web context key during MODX installation instead of the default
web. Changes include:cli-install.php): Newcontext_web_keyprompt with validation (alphanumeric + underscore, forbidsmgrandroot)contexts.php,contexts.tpl): New input field for context key with validation and error displaymodinstallrunner.class.php): NewwriteContextConfig()method that writesconfig.context.phpto the web root with the chosen context keynew.install.php): When a custom key is used, renames thewebcontext and updates related tables (modContextSetting, modContextResource, modAccessContext, modResource)modinstallrequest,modinstallclirequest):context_web_keydefaults towebThe
index.phpalready readsconfig.context.phpwhen present (fallback towebif missing).Why is it needed?
Allows users to install MODX with a custom front-end context key (e.g.
site,frontend) instead of requiringweb. Useful for multi-site setups, security through obscurity, or naming conventions.How to test
CLI install:
php setup/cli-install.php --context_web_key=site # Or: php setup/cli-install.php (prompt will ask for context key, default: web)Web install:
site) in the "Web context key" fieldconfig.context.phpexists in web root withreturn 'site';Validation:
website-key) → error on web, fallback on CLImgr,root) → error on web, fallback on CLIRelated issue(s)/PR(s)
Resolves #14462