bonny / WordPress-Simple-History

🔍🕵️‍♀️ WordPress audit log that track user changes in WordPress admin using a nice activity feed.
https://simple-history.com
309 stars 70 forks source link

Enhancement: Allow settings changes via WP-CLI #203

Open rklrkl opened 4 years ago

rklrkl commented 4 years ago

When you host many WP sites, WP-CLI becomes incredibly useful to change multiple WP sites on an automated basis. At the moment, Simple History just has a "list" option for WP-CLI (bet you didn't even know it had that - no mention of it is made on the wordpress.org page for the plugin!).

I would ultimately like all the settings options in Simple History to be controllable via WP-CLI (and further added to in the future if a new option is added). This would dramatically improve Simple History for Web hosters, IMHO.

bonny commented 2 months ago

This would be useful.

~Is all that is required to add "show_in_rest" to each setting during register_setting?~

No above was for Rest API access. Perhaps that would be useful to.

Listing and setting options is possible at the moment using the wp cli "option" command. For example:

$ wp option list --fields=option_name,option_value --search="simple_history_*"

+--------------------------------------------------------------------+--------------+
| option_name                                                        | option_value |
+--------------------------------------------------------------------+--------------+
| simple_history_db_version                                          | 1            |
| simple_history_debug                                               | 1            |
| simple_history_detective_mode                                      | 1            |
| simple_history_detective_mode_enabled                              | 1            |
| simple_history_enable_rss_feed                                     | 1            |
| simple_history_pager_size                                          | 20           |
| simple_history_pager_size_dashboard                                | 10           |
| simple_history_rss_secret                                          | abc          |
| simple_history_show_as_page                                        | 1            |
| simple_history_show_on_dashboard                                   | 1            |
| simple_history_total_rows                                          | 40000        |
+--------------------------------------------------------------------+--------------+

But it would be nice to have more user friendly way to see and set the options. Perhaps:

$ wp simple-history setting get pager_size $ wp simple-history setting update pager_size 10

See: