admin管理员组文章数量:1415697
How do you guys handle database changes, more specifically the settings (wp_options)?
Im looking for something like, having a JSON file (or migration files bit similar like Laravel) with settings, that I can run after a deployment.
For example once I install WooCommerce I have a list with default settings (presets) I want to use and import at once. But also once I add a new feature or plugin that I can migrate those settings across multiple environments.
Would be cool if that JSON file (or settings file) is environment based. So I can use test payment method settings on local and live settings on production. And just run a command like wp migrate options or something in my deployment script, which sets all the correct settings for that environment.
Is there something like that?
Thanks in advance :)
How do you guys handle database changes, more specifically the settings (wp_options)?
Im looking for something like, having a JSON file (or migration files bit similar like Laravel) with settings, that I can run after a deployment.
For example once I install WooCommerce I have a list with default settings (presets) I want to use and import at once. But also once I add a new feature or plugin that I can migrate those settings across multiple environments.
Would be cool if that JSON file (or settings file) is environment based. So I can use test payment method settings on local and live settings on production. And just run a command like wp migrate options or something in my deployment script, which sets all the correct settings for that environment.
Is there something like that?
Thanks in advance :)
Share Improve this question asked Aug 12, 2019 at 13:11 Johan van der MolenJohan van der Molen 31 bronze badge1 Answer
Reset to default 0This is a tricky one since even if you might get it to work with Core with plugins you never know if they also store data in files, custom tables, post types and so in. If you then only sync the options table you might get inconsistent/partial/broken states. Also you probably don't want to sync everything since some things like transients are on the options table but aren't really settings.
This is a general problem with systems that store configuration in the database and even more so with WP since the data storage formats are somewhat fragile.
If you search the web or this site you'll see that there have been plenty of questions and attempts of approaching this. But there is no general best practice solution to it.
Having said that, concerning your specific request you can have a look at https://github/danielbachhuber/dictator which looks like it is unmaintained but might give you a head start on one possible approach.
本文标签: Sync plugin settings (wpoptions table) on multiple environments
版权声明:本文标题:Sync plugin settings (wp_options table) on multiple environments 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745237488a2649121.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论