Skip to content

Allow wp config create to defer DB_NAME/DB_USER initialization via --skip-check#223

Merged
swissspidy merged 3 commits intomainfrom
copilot/add-defer-parameter-initialization
Apr 16, 2026
Merged

Allow wp config create to defer DB_NAME/DB_USER initialization via --skip-check#223
swissspidy merged 3 commits intomainfrom
copilot/add-defer-parameter-initialization

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 15, 2026

wp config create currently blocks a deferred “create then set constants” workflow by requiring --dbname and --dbuser even when connection checks are intentionally skipped. This change makes that path explicit while preserving existing validation when checks are enabled.

  • Behavior change: deferred initialization path

    • --dbname and --dbuser are now optional when --skip-check is used.
    • wp-config.php is generated with empty DB_NAME / DB_USER if omitted, enabling follow-up wp config set workflows.
  • Validation preserved for checked path

    • Existing parameter errors for missing --dbname / --dbuser remain in place when --skip-check is not used (and SQLite drop-in is not active).
  • Command docs updated

    • Option help text for --dbname and --dbuser now reflects: required only when connection checks are performed (or no SQLite drop-in shortcut applies).
  • Acceptance coverage updated

    • Added/updated Behat scenarios to cover both:
      • success with --skip-check and missing one of --dbname / --dbuser
      • error behavior when --skip-check is not provided
# now supported: generate config first, initialize constants later
wp config create --skip-check --dbuser=someuser
wp config set DB_NAME wordpress

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.wordpress.org
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)
    • Triggering command: /usr/bin/php /usr/bin/php /home/REDACTED/work/config-command/config-command/vendor/wp-cli/wp-cli/bin/../php/boot-fs.php core download --skip-content --quiet (dns block)
    • Triggering command: /usr/bin/curl curl -s REDACTED git conf�� --local credential.username /home/REDACTED/work/_temp/ghcca-node/node/bin/git (dns block)
  • downloads.wordpress.org
    • Triggering command: /usr/bin/php php vendor/bin/behat --snippets-for=WP_CLI\Tests\Context\FeatureContext --format progress --tags=~@broken&&~@require-object-cache&&~@require-mariadb&&~@require-mysql&&~@require-mysql-or-mariadb&&~@skip-sqlite --strict (dns block)
    • Triggering command: /usr/bin/php php vendor/bin/behat features/config-create.feature --name Missing --dbname or --dbuser rt-size '1280, 720' --output-dir /tmp/playwright-logs --allowed-origins 'localhost;localhost:*;1which (dns block)
    • Triggering command: /usr/bin/php php vendor/bin/behat -vvv features/config-create.feature --name Missing --dbname or --dbuser (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add option to defer parameter initialization in wp config create Allow wp config create to defer DB_NAME/DB_USER initialization via --skip-check Apr 15, 2026
Copilot AI requested a review from swissspidy April 15, 2026 15:18
@swissspidy swissspidy added this to the 2.5.2 milestone Apr 15, 2026
@swissspidy

This comment was marked as resolved.

This comment was marked as resolved.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy marked this pull request as ready for review April 15, 2026 21:30
@swissspidy swissspidy requested a review from a team as a code owner April 15, 2026 21:30
Copilot AI review requested due to automatic review settings April 15, 2026 21:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates wp config create to support a deferred initialization workflow by allowing DB_NAME and/or DB_USER to be omitted when --skip-check is used, while keeping the existing required-parameter validation when connection checks are enabled.

Changes:

  • Make --dbname / --dbuser optional when --skip-check is provided (unless SQLite integration detection already bypasses checks).
  • Update inline command option documentation to reflect the conditional requirement.
  • Add/adjust Behat coverage for the new --skip-check missing-parameter success path and the unchanged error path without --skip-check.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Config_Command.php Adjusts option docs and validation logic so dbname/dbuser are only required when DB checks are performed.
features/config-create.feature Adds scenarios for successful config generation with --skip-check and missing dbname/dbuser, and updates the existing required-parameter error scenario.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@swissspidy swissspidy merged commit b26a757 into main Apr 16, 2026
66 checks passed
@swissspidy swissspidy deleted the copilot/add-defer-parameter-initialization branch April 16, 2026 10:38
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 scope:distribution Related to distribution scope:documentation Related to documentation state:unconfirmed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wp config create would benefit from clear path to defer all parameter initialization.

3 participants