Open porg opened 1 year ago
Great idea, @porg !
This is similar to a project I worked on in the past: https://github.com/danielbachhuber/dictator
I've moved your issue to the wp-cli/ideas repo. Our existing packages try to emulate WordPress core behavior as much as possible. This particular idea probably makes most sense as a standalone package.
If you'd like to work on such a package, here are some docs to help get you started: https://make.wordpress.org/cli/handbook/guides/commands-cookbook/
Hope this helps!
Flattered that you like my idea! As mentioned I'm a UX designer and no developer.
To model the command verbs along the Wordpress core terminology is a good decision! My wording below is purely to present the idea. Ofc it should match the typical wp-cli
style and grammar.
restore
with various sub-commands not suited for the intended use:
$ wp restore
--plugins [ full-or-partial-DB-file | plugins.csv ] β¦ specific opts e.g. --plugin-version=preserve
--themes [ full-or-partial-DB-file | themes.csv ] β¦ specific opts e.g. --theme-activation-status=preserve
--database ideally-full-DB-file β¦ specific opts e.g. [ --database-prefix-old "wp_" --database-prefix-prefix-new "wp2_" ]
β¦
You see: It quickly gets a mess. Because with a database file as a source the user may have different intents for the target (restore the plugins from it or the database tables itself, or only the plugin options, or β¦ or β¦). It gets manifold pretty soon!
2) Hence I propose to rather integrate a --restore
option to each of the destination specific commands like plugin / theme / db.
In the destination context of plugin
using --restore
from [ database | csv | json ]
with additional options like --activation=preserve
, --version=preserve
and --auto-update=preserve
(see #344) will restore the attributes of all plugins as found in the --restore
source.
Note: I assume "preserve" to be a safe special reserved word here, because I doubt it to be ever used as a value in a version, activation-status or auto-update-status.
Exception handling: If the --restore
source is a flat list (plugin names only, space or newline separated),
--version=preserve
gets ignored and instead simply the newest version gets loaded,--autoUpdateState=on|off
and --activation=on|off
you can set/override the respective attribute for all plugins (regardless if source contains attributes or not).In the destination context of database
, the most additional options will accumulate over time, b/c there are so many interesting use cases. These can grows over time.
The destination context of theme
is the least complex one. Simply as only 1 theme can be active, it is already less complex than plugin
I guess.
https://github.com/danielbachhuber/dictator is not available, but I found https://danielbachhuber.com/introducing-dictator/
https://github.com/danielbachhuber/dictator is not available
@porg Oh! Sorry, I made it a private archive previously and forgot about it.
These folks are actively working on it: https://github.com/boxuk/dictator
As I understand it, the practical goal of this is to clone a Wordpress Site in terms of plugins and/or themes and/or configuration to a fresh site without necessarily the content data (posts, pages, categories, media, users).
Yes β and offer an abstraction for doing so, to bring the data into a YAML file that can be tracked in version control.
It is abandoned. Why? Are there meanwhile other established methods for this?
Oh, I didn't want to pursue it anymore.
dictator
become the standard way for the forementioned practical goal?
What you did not answer: Has
dictator
become the standard way for the forementioned practical goal?
- Or other methods/apps/software-stacks?
- Or is cloning/version-managing Wordpress overall still a very vivid/developing/competitive domain?
- I'd appreciate a good link or summary on this. Thanks!
I have no idea! I think this would make a great blog post π Post Status might pay you for a guest contribution.
Thanks for the info. As a relatively new arrival to the Wordpress scene (intensive research for my website from 9-12/2021, then a pause (content creation), now 12/2022 resuming website work) I may have the unbiased outside view, and see features or the lack of it, maybe differently.
But nevertheless I'm no expert at all for a serious guest contribution.
Maybe when my website is finally done, and I had some "DevOps" experience with it (with life teaching disasters along the way π ) I may qualify π
Big picture: Efficiently backup my Wordpress database. Then restore Wordpress Core + Extensions (Themes, Plugins) as exactly as possible in an automated fashion.
wp_options
in the various*_plugins
rows.wp plugin list
.