wp-cli / config-command

Generates and reads the wp-config.php file.
MIT License
38 stars 36 forks source link

Test MySQL connection using native PHP functions #152

Closed adamziel closed 1 year ago

adamziel commented 1 year ago

Description

Testing the MySQL connection via new PDO() or mysqli_connect() would make the config create command more portable. At the moment, the connection test requires support for a proc_open function and a shell mysql client. Both are problematic in the context of WebAssembly WordPress Playground.

https://github.com/wp-cli/config-command/blob/965be26705e67dc1438b6a8f81232d73f4e95db4/src/Config_Command.php#L164-L166

danielbachhuber commented 1 year ago

Thanks for the suggestion, @adamziel !

Here's where the db check was added originally:https://github.com/wp-cli/wp-cli/pull/484

I suspect the mysql executable was used because wpdb.php isn't available yet. It should be fine to switch over if we can, though.

wojtekn commented 1 year ago

@adamziel @danielbachhuber I opened a PR https://github.com/wp-cli/config-command/pull/158 with this change.

adamziel commented 1 year ago

cc @dmsnell