bobbingwide / oik-clone

Clone content between sites
https://www.oik-plugins.com/oik-plugins/oik-clone-clone-your-wordpress-content/
GNU General Public License v2.0
5 stars 0 forks source link

Add batch clone facility for WordPress MultiSite #31

Open bobbingwide opened 5 years ago

bobbingwide commented 5 years ago

The oik-clone Admin MultiSite tab ( #28 ) solution is fine when there's only a small amount of content to clone. But what about when I want to clone a whole raft of items? For example all the documentation for the core and core-embed blocks created in core.wp.a2z that need to be cloned to blocks.wp.a2z and the other blocks in the other subdomains.

Requirement

WordPress MultiSite batch clone pull facility

To pull content from one site to another. A batch interface for the:

WordPress batch push facility

To push content from one site to another. A batch interface to the [clone] shortcode.

Once the content has been generated/updated locally then we need to be able to identify and push changes, as required. For a manual front end method see https://www.oik-plugins.com/shortcode_example/most-recent-work/

Proposed solution

Notes

The solution needs to be more advanced than just using WP-CLI

 wp post create --from-post=1

a method mentioned here https://wordpress.stackexchange.com/questions/253234/how-do-i-clone-or-duplicate-a-post-with-the-wordpress-command-line-interface-wp

bobbingwide commented 5 years ago

In order to make the pull logic work we need to record the target clone id back in the source otherwise mapping of relationships won't work. This needs to be done for both MultiSite pull and batch pull.

bobbingwide commented 5 years ago

It would be helpful if the batch routines check a couple of things.

  1. For push or pull, that the url= parameter, if passed, is valid in the context.
  2. Additional logic which is only available for WPMS. e.g. to avoid calling switch_to_blog() and restore_current_blog() in single site.
  3. For push, check a dry-run a dry-run parameter; do not push when dry-run=y
bobbingwide commented 3 years ago

Even though oik-clone v2.0.0 has been released I'm not going to close this until the solution's been documented.

Documentation should refer to batch processes: reconcile.bat and reconciled.bat, and the new routines run under oik-batch. And these routines need updating to reflect changes in the target test environments.