Skip to content

Enhancement/added import command lock flag#83

Open
dm-vasylenko wants to merge 3 commits into
semaio:mainfrom
studioraz:enhancement/added-import-command-lock-flag
Open

Enhancement/added import command lock flag#83
dm-vasylenko wants to merge 3 commits into
semaio:mainfrom
studioraz:enhancement/added-import-command-lock-flag

Conversation

@dm-vasylenko
Copy link
Copy Markdown

@dm-vasylenko dm-vasylenko commented Mar 3, 2026

Please make sure these boxes are checked before submitting your PR - thank you!

  • Pull request is based against main branch
  • README.md reflects changes (if applicable)
  • New files contain a license header

Proposed changes

Added --lock-config (-c) option to the config:data:import CLI command. When used, imported configuration values are written to both the database (core_config_data) and app/etc/config.php, making them
read-only (greyed out) in Admin > Stores > Configuration.

Changed files

Command/ImportCommand.php

  • Added --lock-config (-c) option definition in configure()

Model/Processor/ImportProcessor.php

  • Added 3 constructor dependencies: DeploymentConfig\Writer, ConfigPathResolver, ArrayManager
  • During the import loop, values are collected into a $lockData array when --lock-config is active
  • After the loop, all collected values are batch-written to app/etc/config.php in a single saveConfig() call (merge mode)
  • !!DELETE entries print a notice that locked values in config.php must be removed manually
  • !!KEEP entries are unaffected (skipped as before)

README.md / docs/config-import.md

  • Documented the new --lock-config option with usage examples and caveats

Usage

Standard import (unchanged)

php bin/magento config:data:import config/store production

Import + lock in config.php

php bin/magento config:data:import config/store production --lock-config

...

This PR adds an additional --lock-config option to the import command. Issue #24

@therouv
Copy link
Copy Markdown
Contributor

therouv commented Mar 9, 2026

Thank you, @dm-vasylenko ! Looks good.
Will fix the CS issues and merge it manually tomorrow :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants