Open
Description
Feature Request
- Yes, I reviewed the contribution guidelines.
Describe your use case and the problem you are facing
In the wordpress-develop repo, running npm run env:install
does the following:
wp_cli( `config set WP_DEBUG ${process.env.LOCAL_WP_DEBUG} --raw --type=constant` );
wp_cli( `config set WP_DEBUG_LOG ${process.env.LOCAL_WP_DEBUG_LOG} --raw --type=constant` );
wp_cli( `config set WP_DEBUG_DISPLAY ${process.env.LOCAL_WP_DEBUG_DISPLAY} --raw --type=constant` );
wp_cli( `config set SCRIPT_DEBUG ${process.env.LOCAL_SCRIPT_DEBUG} --raw --type=constant` );
wp_cli( `config set WP_ENVIRONMENT_TYPE ${process.env.LOCAL_WP_ENVIRONMENT_TYPE} --type=constant` );
wp_cli( `config set WP_DEVELOPMENT_MODE ${process.env.LOCAL_WP_DEVELOPMENT_MODE} --type=constant` );
The multiple calls here result in a poor experience as each command is invoked in a separate process firing up Docker each time:
[+] Creating 2/2
✔ Container wordpress-develop-mysql-1 Running 0.0s
✔ Container wordpress-develop-php-1 Running 0.0s
Success: Generated 'wp-config.php' file.
[+] Creating 2/2
✔ Container wordpress-develop-mysql-1 Running 0.0s
✔ Container wordpress-develop-php-1 Running 0.0s
Success: Updated the constant 'WP_DEBUG' in the 'wp-config.php' file with the raw value 'true'.
[+] Creating 2/2
✔ Container wordpress-develop-mysql-1 Running 0.0s
✔ Container wordpress-develop-php-1 Running 0.0s
Success: Added the constant 'WP_DEBUG_LOG' to the 'wp-config.php' file with the raw value 'true'.
[+] Creating 2/2
✔ Container wordpress-develop-php-1 Running 0.0s
✔ Container wordpress-develop-mysql-1 Running 0.0s
Success: Added the constant 'WP_DEBUG_DISPLAY' to the 'wp-config.php' file with the raw value 'true'.
[+] Creating 2/2
✔ Container wordpress-develop-php-1 Running 0.0s
✔ Container wordpress-develop-mysql-1 Running 0.0s
Success: Added the constant 'SCRIPT_DEBUG' to the 'wp-config.php' file with the raw value 'true'.
[+] Creating 2/2
✔ Container wordpress-develop-mysql-1 Running 0.0s
✔ Container wordpress-develop-php-1 Running 0.0s
Success: Added the constant 'WP_ENVIRONMENT_TYPE' to the 'wp-config.php' file with the value 'local'.
[+] Creating 2/2
✔ Container wordpress-develop-php-1 Running 0.0s
✔ Container wordpress-develop-mysql-1 Running 0.0s
Success: Added the constant 'WP_DEVELOPMENT_MODE' to the 'wp-config.php' file with the value 'core'.
[+] Creating 2/2
✔ Container wordpress-develop-mysql-1 Running 0.0s
✔ Container wordpress-develop-php-1 Running 0.0s
Success: Added the constant 'FOO_BAR' to the 'wp-config.php' file with the value 'baz'.
[+] Creating 2/2
✔ Container wordpress-develop-mysql-1 Running 0.0s
✔ Container wordpress-develop-php-1 Running 0.0s
Success: Database reset.
[+] Creating 2/2
✔ Container wordpress-develop-php-1 Running 0.0s
✔ Container wordpress-develop-mysql-1 Running
Describe the solution you'd like
I'd like to be able to set multiple config values in one command. This was also requested for wp option update
in wp-cli/entity-command#230.
Such batch setting of config values may make the most sense as using JSON as input, as it probably doesn't make sense to try to pass everything in one command as args.
An alternative to this: wp-cli/ideas#180
Metadata
Metadata
Assignees
Labels
No labels