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... |
This comment was marked as resolved.
This comment was marked as resolved.
|
Hey @swissspidy. I missed that #219 had been updated recently. When I checked it earlier there were unaddressed review comments, but I see it's been iterating since. If any of the specific fixes in this PR are useful (e.g. the rtrim(ABSPATH, '/\') for consistency with existing code in the same method, or the @skip-sqlite scenario for MySQL validation coverage), happy to move those as suggestions to #219. |
|
Yes please move this to suggestions on the other PR, thank you! |
|
Closing in favor of #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