Skip to content

Refactor wp config create to set config values through WPConfigTransformer#226

Open
swissspidy with Copilot wants to merge 14 commits into
mainfrom
copilot/refactor-config-command-validation
Open

Refactor wp config create to set config values through WPConfigTransformer#226
swissspidy with Copilot wants to merge 14 commits into
mainfrom
copilot/refactor-config-command-validation

Conversation

Copilot AI commented May 27, 2026

Copy link
Copy Markdown
Contributor

wp config create still had a separate value-writing path from the transformer-backed commands, which duplicated escaping/validation behavior and made new validation logic hard to centralize. This change makes create a thin wrapper: render defaults first, then apply requested values through wp-cli/wp-config-transformer.

  • Create flow now routes value writes through transformer

    • Render wp-config.mustache with baseline defaults (including empty placeholders for salts when needed).
    • After file creation, apply user-provided DB/table-prefix values via WPConfigTransformer::update().
    • Apply generated salts via WPConfigTransformer::update() when salts are generated.
    • Keep fallback remote salts injection behavior intact when local generation fails.
  • Removed create-specific escaping path

    • Deleted the legacy escape_config_value() path used only by create.
    • Value formatting/escaping behavior is now consistently handled by the transformer library for transformed entries.
  • Focused feature coverage for transformer-path escaping

    • Added a config create feature scenario covering special-character handling for DB_CHARSET to ensure values written through the transformer are preserved and readable via wp config get.
$config_transformer->update(
	'constant',
	'DB_CHARSET',
	$assoc_args['dbcharset'],
	[ 'add' => true ]
);

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor config command to always validate in config transformer library Refactor wp config create to set config values through WPConfigTransformer May 27, 2026
Copilot AI requested a review from swissspidy May 27, 2026 09:27
@swissspidy

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.99083% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Config_Command.php 88.99% 12 Missing ⚠️

📢 Thoughts on this report? Let us know!

This comment was marked as resolved.

Copilot AI and others added 4 commits May 27, 2026 18:08
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

This comment was marked as resolved.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@swissspidy swissspidy marked this pull request as ready for review June 11, 2026 10:33
@swissspidy swissspidy requested a review from a team as a code owner June 11, 2026 10:33

This comment was marked as resolved.

swissspidy and others added 3 commits July 9, 2026 12:28
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@swissspidy swissspidy added the command:config-create Related to 'config create' command label Jul 9, 2026
@swissspidy swissspidy requested a review from Copilot July 9, 2026 10:31

This comment was marked as resolved.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:config-create Related to 'config create' command state:unconfirmed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor config command to always validate in config transformer library

3 participants