Skip to content

Make --dbname and --dbuser optional when SQLite integration is active#219

Open
Copilot wants to merge 6 commits intomainfrom
copilot/fix-sqlite-compatibility-issue
Open

Make --dbname and --dbuser optional when SQLite integration is active#219
Copilot wants to merge 6 commits intomainfrom
copilot/fix-sqlite-compatibility-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 1, 2026

wp config create unconditionally requires --dbname and --dbuser, making it impossible to create a config for a SQLite-backed WordPress install without supplying MySQL credentials that will never be used.

Changes

  • Optional synopsis params: --dbname and --dbuser are now [--dbname] / [--dbuser] in the docblock synopsis, with descriptions clarifying they are required unless the SQLite integration drop-in is detected.
  • SQLite detection: New is_sqlite_integration_active() checks for an actual SQLITE_DB_DROPIN_VERSION constant definition in wp-content/db.php (reads first 8 KB only) using is_file()/is_readable() guards and a regex match to avoid false positives from comments or strings.
  • Conditional validation: When SQLite is not detected, missing --dbname or --dbuser still produces an explicit error — existing MySQL/MariaDB behaviour is unchanged.
  • Skip MySQL check for SQLite: The mysqli connection check is bypassed entirely when SQLite is detected, so --skip-check is not required.
  • New @require-sqlite Behat scenario: Verifies wp config create succeeds without --dbname/--dbuser when the SQLite drop-in is present.
  • New @require-mysql Behat scenario: Asserts exit code 1 and the expected error messages when --dbname or --dbuser are omitted on a non-SQLite install, keeping this validation stable going forward.
# SQLite install — now works without MySQL credentials
$ wp config create --skip-salts --skip-check
Success: Generated 'wp-config.php' file.

# MySQL install — still errors clearly if params are omitted
$ wp config create --skip-check
Error: Parameter errors:
missing --dbname parameter (Set the database name.)

Copilot AI linked an issue Apr 1, 2026 that may be closed by this pull request
@github-actions github-actions bot added bug command:config-create Related to 'config create' command scope:testing Related to testing state:unconfirmed labels Apr 1, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 71.42857% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Config_Command.php 71.42% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

…n and skip MySQL check for SQLite

Agent-Logs-Url: https://github.com/wp-cli/config-command/sessions/8f9ece6b-b44b-4ac7-87e2-35bad2b2afff

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix SQLite compatibility issue in db creation tests Make --dbname and --dbuser optional when SQLite integration is active Apr 1, 2026
Copilot AI requested a review from swissspidy April 1, 2026 08:59
@swissspidy swissspidy marked this pull request as ready for review April 2, 2026 11:10
@swissspidy swissspidy requested a review from a team as a code owner April 2, 2026 11:10
Copilot AI review requested due to automatic review settings April 2, 2026 11:10

This comment was marked as resolved.

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

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

@swissspidy swissspidy added this to the 2.5.1 milestone Apr 8, 2026
@swissspidy swissspidy requested a review from Copilot April 9, 2026 06:42
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

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


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

Comment on lines 123 to 127
* [--dbname=<dbname>]
* : Set the database name.
*
* --dbuser=<dbuser>
* [--dbuser=<dbuser>]
* : Set the database user.
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

The synopsis now marks --dbname/--dbuser as optional, but they’re still required for non-SQLite installs (enforced later in create()). To avoid misleading wp help config create output, consider updating the option descriptions to explicitly state “Required unless SQLite integration drop-in is detected.”

Copilot uses AI. Check for mistakes.
…d Behat scenario for missing dbname/dbuser

Agent-Logs-Url: https://github.com/wp-cli/config-command/sessions/53294434-a981-4597-8efc-1a642de88b29

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

Labels

bug command:config-create Related to 'config create' command scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLite Compatibility

3 participants