Support wp-cli
adamziel opened this issue · 5 comments
adamziel commented
Now that proc_open support is available, let's find a way to support wp-cli.
Related tasks
Done is:
- wp-cli runs most tasks without any errors (except for
dbandsearch-replacethat @swissspidy mentioned won't work with SQLite yet)
adamziel commented
I just tried running wp-cli via Playground's php-wasm-cli, and ran into some errors related to creating temporary files:
; PHP=8.0 node --loader=./packages/nx-extensions/src/executors/built-script/loader.mjs ./dist/packages/php-wasm/cli/main.js ../../wordpress-develop/wp-cli.phar
(node:86157) ExperimentalWarning: Custom ESM Loaders is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Warning: proc_open(): Unable to create temporary file. in phar:///wordpress-develop/wp-cli.phar/vendor/wp-cli/wp-cli/php/utils.php on line 1580
Warning: proc_open(): Cannot represent a stream of type TEMP as a File Descriptor in phar:///wordpress-develop/wp-cli.phar/vendor/wp-cli/wp-cli/php/utils.php on line 1580
Fatal error: Uncaught TypeError: proc_close(): Argument #1 ($process) must be of type resource, bool given in phar:///wordpress-develop/wp-cli.phar/vendor/wp-cli/wp-cli/php/commands/src/Help_Command.php:143
Stack trace:
#0 phar:///wordpress-develop/wp-cli.phar/vendor/wp-cli/wp-cli/php/commands/src/Help_Command.php(143): proc_close(false)
#1 phar:///wordpress-develop/wp-cli.phar/vendor/wp-cli/wp-cli/php/commands/src/Help_Command.php(94): Help_Command::pass_through_pager('\e[1mNAME\e[0m\n\n ...')
I started issue #828 to track this problem.
adamziel commented
Some wp-cli commands work on the latest trunk version!
; PHP=8.2 TMPDIR="`pwd`"/tmp node --loader ../plugins/playground/packages/nx-extensions/src/executors/built-script/loader.mjs ../plugins/playground/dist/packages/php-wasm/cli/main.js ./wp-cli.phar user list 1 ↵
+----+------------+--------------+--------------+--------------+---------------+
| ID | user_login | display_name | user_email | user_registe | roles |
| | | | | red | |
+----+------------+--------------+--------------+--------------+---------------+
| 1 | admin | admin | admin@exampl | 2023-02-25 1 | administrator |
| | | | e.org | 9:51:14 | |
+----+------------+--------------+--------------+--------------+---------------+
; PHP=8.2 TMPDIR=`pwd`/tmp node --loader ../plugins/playground/packages/nx-extensions/src/executors/built-script/loader.mjs ../plugins/playground/dist/packages/php-wasm/cli/main.js ./wp-cli.phar config list
+------------------+-----------------------------+----------+
| name | value | type |
+------------------+-----------------------------+----------+
| table_prefix | wptests_ | variable |
| DB_NAME | database_name_here | constant |
| DB_USER | username_here | constant |
| DB_PASSWORD | password_here | constant |
| DB_HOST | localhost | constant |
| DB_CHARSET | utf8 | constant |
| DB_COLLATE | | constant |
| AUTH_KEY | put your unique phrase here | constant |
| SECURE_AUTH_KEY | put your unique phrase here | constant |
| LOGGED_IN_KEY | put your unique phrase here | constant |
| NONCE_KEY | put your unique phrase here | constant |
| AUTH_SALT | put your unique phrase here | constant |
| SECURE_AUTH_SALT | put your unique phrase here | constant |
| LOGGED_IN_SALT | put your unique phrase here | constant |
| NONCE_SALT | put your unique phrase here | constant |
| WP_DEBUG | | constant |
+------------------+-----------------------------+----------+
; PHP=8.2 TMPDIR=`pwd`/tmp node --loader ../plugins/playground/packages/nx-extensions/src/executors/built-script/loader.mjs ../plugins/playground/dist/packages/php-wasm/cli/main.js ./wp-cli.phar eval "echo 1;"
1
The next blocker is #931 and #930. These explorations are highly relevant.
adamziel commented
danielbachhuber commented
So cool! Thanks for driving this forward, @adamziel 😊