You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[6.x] Group GraphQL, image, backup, queue, asset, template, and slug settings into config objects - #20930
Each object can be set fluently, as JSON (CRAFT_GQL='{"maxDepth":10}'), or one setting at a time (CRAFT_GQL_MAX_DEPTH=10).
The old names keep working without the Yii adapter, and log a deprecation warning. BaseConfig::$renamedSettings now accepts dotted targets such as 'enableGql' => 'gql.enabled', and forwards:
property reads and writes ($config->maxGraphqlDepth)
array configs ('maxGraphqlDepth' => 10)
fluent calls (->maxGraphqlDepth(10)), through __call
CRAFT_ variables under the old names (CRAFT_MAX_GRAPHQL_DEPTH). Variables for the new names win, and a variable that's named after both, such as CRAFT_QUEUE_NAME, is applied as the new setting only.
Values set under an old name go through the new setting's fluent method, so maxUploadFileSize is still converted to bytes and extraAllowedFileExtensions still merges into allowedFileExtensions.
Also:
fromConfig() moved to BaseConfig, shared by every config object.
GeneralConfig::getBackupOnUpdate(), getTempAssetUploadDisk(), getUploadSessionDisk(), getTrashedAssetDisk(), and the IMAGE_DRIVER_* constants are deprecated in favor of methods and constants on the new objects.
The adapter's renamed settings (backupDbOnUpdate, enableGraphQlCaching, tempAssetUploadFs) point to the new paths, and the Yii2 Loose Ends utility lists the new renames.
Before: with the rename map emptied, or with __set assigning properties directly, these tests fail. After: they pass, along with the existing config, GraphQL, asset, image, queue, backup, template, and element suites, and the adapter's Laravel suite.
Groups related Craft CMS settings into seven typed configuration objects, extending the existing mcp and anchors pattern while retaining compatibility with legacy setting names.
Changes:
Adds grouped configuration objects and shared array/JSON initialization.
Forwards legacy settings and environment variables to nested settings, with deprecation handling.
Migrates core and Yii adapter consumers, updates tests, and documents the new configuration paths.
The new shared factory silently drops renamed settings because they no longer satisfy property_exists() or method_exists(). For example, returning GeneralConfig::fromConfig(['enableGql' => false]) from general.php leaves GraphQL enabled, whereas returning the same array directly correctly disables it through __set(). Please route keys in the rename map through __set() here as well, preserving normalization and deprecation logging.
Capture the original caller for deferred deprecation logs
src/Config/BaseConfig.php:204
When an old setting is used before application boot, the deferred log records the boot callback’s location instead of the caller in config/craft/general.php. This points users to the wrong file and line and merges separate uses of the same setting into one deprecation fingerprint. Capture the caller’s backtrace before deferring, then resolve its origin and pass the file and line to Deprecator::log().
Adds `GqlConfig` and the `gql` general config setting, which replaces the
eleven flat GraphQL settings. The old names, including their fluent
methods and `CRAFT_` environment variables, forward to `gql` through
`BaseConfig`'s renamed settings, which now accept dotted targets, and log
a deprecation warning.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1f9b3-3d39-7447-bc6d-a85c563eee0d
Co-authored-by: Amp <amp@ampcode.com>
Adds `ImagesConfig`, `BackupsConfig`, and `QueueConfig`, and the `images`,
`backups`, and `queue` general config settings, which replace 21 flat
settings. The old names forward to them through `RENAMED_SETTINGS`, and
log a deprecation warning. A `CRAFT_` variable that's named after both
an old and a new setting, such as `CRAFT_QUEUE_NAME`, is applied as the
new setting only.
`fromConfig()` moves to `BaseConfig`, which every config object shares.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1f9b3-3d39-7447-bc6d-a85c563eee0d
Co-authored-by: Amp <amp@ampcode.com>
Adds `AssetsConfig` and the `assets` general config setting, which
replaces the 15 settings in the Assets group, including the file
extension merging and upload size conversion they did. The old names
forward to it through `RENAMED_SETTINGS`, and log a deprecation warning.
Renamed settings now forward through the new setting's fluent method,
when it has one, so values set under an old name are normalized the same
way.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1f9b3-3d39-7447-bc6d-a85c563eee0d
Co-authored-by: Amp <amp@ampcode.com>
Adds `TemplatesConfig` and `SlugsConfig`, and the `templates` and `slugs`
general config settings, which replace ten flat settings. The old names
forward to them through `RENAMED_SETTINGS`, and log a deprecation
warning.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1f9b3-3d39-7447-bc6d-a85c563eee0d
Co-authored-by: Amp <amp@ampcode.com>
`Stub::make()` stubs the `gql()` fluent method instead of setting the
`gql` property, and skips the constructor, so writing `gqlTypePrefix`
reached an uninitialized `gql` object.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1f9b3-3d39-7447-bc6d-a85c563eee0d
Co-authored-by: Amp <amp@ampcode.com>
- Renamed settings are returned by reference, so writes such as
`$config->allowedFileExtensions[] = 'mbox'` reach the new setting.
- `CRAFT_` variables named after renamed settings are applied before
the variables for the new settings, including whole-object ones such
as `CRAFT_GQL`, so the new names always win.
- Those variables now change a clone of the nested config object, so a
cached config's objects aren't changed.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1f9b3-3d39-7447-bc6d-a85c563eee0d
Co-authored-by: Amp <amp@ampcode.com>
- `Typecast` converts `int|false` settings, so `CRAFT_BACKUPS_MAX=5` and
`CRAFT_MAX_BACKUPS=5` no longer throw a `TypeError`.
- `BaseConfig::fromConfig()` forwards renamed settings, such as
`GeneralConfig::fromConfig(['enableGql' => false])`.
- Deprecation logs for renamed settings capture the caller before they're
deferred, so they point at the file and line that used the old name.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1f9b3-3d39-7447-bc6d-a85c563eee0d
Co-authored-by: Amp <amp@ampcode.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The renamed setter forwards string values without normalization from a strictly typed file, causing a TypeError that prevents startup for configurations such as maxGraphqlDepth(env('MAX_DEPTH')).
`BaseConfig::__call()` forwards calls from a strictly typed file, so a
non-strict `general.php` calling `->maxGraphqlDepth('10')` threw a
`TypeError` instead of getting the coercion a direct call had. The value
is now typecast for the new setting first, as `__set()` does.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1f9b3-3d39-7447-bc6d-a85c563eee0d
Co-authored-by: Amp <amp@ampcode.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed to evaluate a named-argument coercion regression and incorrect restore-command placeholder documentation identified in unpublished findings.
`brokenImagePath` is now `images.brokenPath`. The old setting and its
`CRAFT_BROKEN_IMAGE_PATH` environment variable still work and log a
deprecation warning.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1f9b3-3d39-7447-bc6d-a85c563eee0d
Co-authored-by: Amp <amp@ampcode.com>
…nfig objects
Adds `RoutingConfig`, `SecurityConfig`, `UsersConfig`, and
`GarbageCollectionConfig`, and the `routing`, `security`, `users`, and
`garbageCollection` general config settings, which replace 43 flat
settings. `rememberUsernameDuration` moves to `security`. The old names
forward to them through `RENAMED_SETTINGS`, and log a deprecation
warning. The path, page trigger, and auth getters move with their
settings; the `GeneralConfig` ones are deprecated and delegate to them.
A renamed setting that keeps its name and has an `#[EnvName]` attribute,
such as `disable2fa`, now keeps its old environment variable name
(`CRAFT_DISABLE_2FA`).
Amp-Thread-ID: https://ampcode.com/threads/T-01a1f9b3-3d39-7447-bc6d-a85c563eee0d
Co-authored-by: Amp <amp@ampcode.com>
The guard and password broker getters moved there from GeneralConfig, so
the architecture test's allowlist moves with them, and GeneralConfig drops
its unused Auth and Password imports.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1f9b3-3d39-7447-bc6d-a85c563eee0d
Co-authored-by: Amp <amp@ampcode.com>
…ltTransformer()
addTransformer() pairs with transformers() the way addAlias() pairs with
aliases(), and doesn't read like a getter. defaultTransformer() keeps its
name when these settings move into the assets config object from #20930.
The env override is now CRAFT_ASSET_TRANSFORMERS_DEFAULT_TRANSFORMER.
Amp-Thread-ID: https://ampcode.com/threads/T-7e5890db-fcff-466b-96f7-c1b06efaa5df
Co-authored-by: Amp <amp@ampcode.com>
Heads-up: #21018 merged, deprecating CRAFT_ general config overrides. For this PR:
Expect conflicts in GeneralConfig.php docblocks; drop the new CRAFT_* examples and show env() instead.
The renamed-variable path (CRAFT_ENABLE_GQL → gql.enabled) should log the same deprecation. It already has $envName, so log with that; deprecateEnvironmentOverrides() reflects on properties and won't find renamed ones.
Takes #21018's docblocks, which drop the `CRAFT_*` environment override
examples, and drops them from the new config objects' docblocks too.
Environment variables named after renamed settings, such as
`CRAFT_ENABLE_GQL`, now log #21018's environment override deprecation as
well as the renamed setting one.
`maxCachedCloudSize` is removed from `ImagesConfig`, since 6.x removed
`maxCachedCloudImageSize`, and new 6.x code reads the moved settings from
their config objects.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1f9b3-3d39-7447-bc6d-a85c563eee0d
Co-authored-by: Amp <amp@ampcode.com>
This branch has not been deployed
No deployments
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
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.
Description
Groups related general config settings into config objects, the way
mcpandanchorsalready work.Each object can be set fluently, as JSON (
CRAFT_GQL='{"maxDepth":10}'), or one setting at a time (CRAFT_GQL_MAX_DEPTH=10).The old names keep working without the Yii adapter, and log a deprecation warning.
BaseConfig::$renamedSettingsnow accepts dotted targets such as'enableGql' => 'gql.enabled', and forwards:$config->maxGraphqlDepth)'maxGraphqlDepth' => 10)->maxGraphqlDepth(10)), through__callCRAFT_variables under the old names (CRAFT_MAX_GRAPHQL_DEPTH). Variables for the new names win, and a variable that's named after both, such asCRAFT_QUEUE_NAME, is applied as the new setting only.Values set under an old name go through the new setting's fluent method, so
maxUploadFileSizeis still converted to bytes andextraAllowedFileExtensionsstill merges intoallowedFileExtensions.Also:
fromConfig()moved toBaseConfig, shared by every config object.GeneralConfig::getBackupOnUpdate(),getTempAssetUploadDisk(),getUploadSessionDisk(),getTrashedAssetDisk(), and theIMAGE_DRIVER_*constants are deprecated in favor of methods and constants on the new objects.backupDbOnUpdate,enableGraphQlCaching,tempAssetUploadFs) point to the new paths, and the Yii2 Loose Ends utility lists the new renames.Evidence
__setassigning properties directly, these tests fail.After: they pass, along with the existing config, GraphQL, asset, image, queue, backup, template, and element suites, and the adapter's Laravel suite.