Make --dbname and --dbuser optional when SQLite is active#221
Make --dbname and --dbuser optional when SQLite is active#221abhi3315 wants to merge 2 commits intowp-cli:mainfrom
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Code Review
This pull request introduces support for SQLite integration in the wp config create command, allowing users to omit the --dbname and --dbuser parameters when an SQLite drop-in is detected. The changes include a new helper method to check for the SQLite drop-in, updated parameter validation logic, and corresponding feature tests. I have provided feedback regarding the robust construction of the wp-content directory path to avoid potential path concatenation errors and suggested simplifying the error messages for better clarity.
|
Please note that we already have an active PR for this at #219... |
wp config createrequires--dbnameand--dbusereven when the SQLite integration plugin is active. SQLite doesn't use these parameters, so users are forced to pass dummy MySQL credentials to create a wp-config.php for a SQLite-backed site.Addresses the enhancement suggested by @mrsdizzie in #167 (comment).
Also incorporates all review feedback from #219 (batched error messages,
is_readable()guard,isset()instead ofempty()).Changes
--dbnameand--dbuserare now optional ([--dbname=<dbname>],[--dbuser=<dbuser>])is_sqlite_integration_active()method scanswp-content/db.phpforSQLITE_DB_DROPIN_VERSION, matching the approach used byDB_Command_SQLite::is_sqlite()--dbname/--dbuserstill produces an error with both parameters reported in a single messageTest coverage
@require-sqlitescenario: verifieswp config create --skip-saltssucceeds without--dbname/--dbuserwhen the SQLite drop-in is present@skip-sqlitescenario: verifies the error message when both parameters are missing on MySQL/MariaDBFixes #167
--
Related wp-cli/wp-cli#6295