New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`wp core config` to handle updates as well #2501

Closed
borekb opened this Issue Feb 22, 2016 · 2 comments

Comments

2 participants
@borekb
Contributor

borekb commented Feb 22, 2016

I'd like to see the core config command handle updates as well. For example, for updating WP_DEBUG, I'd run something like this:

wp core config WP_DEBUG true

(similarly to git config user.name Name).

A couple of quick notes:

  • I understand that wp-config.php can contain arbitrary PHP and implementing the proposed functionality can be a bit tricky. My approach would be to strictly specify how the core config command works, for example, only supporting simple constants and putting them right before require_once(ABSPATH . 'wp-settings.php'); or something like that. If the file structure doesn't conform to what core config expects, it would do nothing and only print an error message.
  • Was thinking whether there should be a separate (sub)command for this but I think that the core config could be used for this seamlessly.
  • Data types would need some attention. For example, the example given above (updating WP_DEBUG) would need to correctly put a boolean into wp-config.php while in other cases, strings or numbers could be required. I think that most cases could be handled automatically but there could also be switches like --bool or --int, similarly to what git config supports.

What do you think? I'd be willing to contribute the code but wanted to discuss it first.

@danielbachhuber

This comment has been minimized.

Member

danielbachhuber commented Feb 22, 2016

I'm open to the idea, generally. Reliably updating values without breaking wp-config.php is my biggest concern at the moment. However, I think it would be better off as wp core config update to avoid an ambiguous command that does multiple things.

You could also start things off as a community command to prove the concept.

@danielbachhuber

This comment has been minimized.

Member

danielbachhuber commented Aug 10, 2016

You could also start things off as a community command to prove the concept.

I've filed this as a Spark until someone comes along with a community package for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment