
What has cloning ever done for us?
Asked by: Fuzzy Duck, Ducky Fuzz and the other one
Coming up to five years ago I published my requirements for cloning content between sites. One of the planned enhancements was to support pull cloning. ie. Pulling updated content back from a slave server to the local system, providing the same content cloning functionality as for push cloning, including attachments.
I’m going on holiday to New Zealand fairly soon. I won’t be taking my laptop. I want to be able to import any changes I make on my websites back to my development machine.
Back in June 2019, when I first started writing this post, I developed a batch interface to support push, pull and reconciliation. Then I got sidelined with Do Not Clone
logic to cater for posts that get cloned both between subdomains and local and slave servers.
Over the last couple of days, I’ve written a new Slave tab for the oik options > Clone admin page. I think I’ve nearly cracked it. It even seems to work for attachments. I can Import, Pull, Push and Clone content, including re-usable blocks.
Now I’m going to find out if it really does work. Fingers crossed. I’ve packaged a new version of the plugin as v2.0.0-beta-20200127. I don’t think I need to install the plugin on my servers since the changes apply to my local development. But I might as well.
Wish me luck! PS. I will be taking backups before I do anything too drastic.
Requirements
To be able to reconcile changes made to blocks.wp-a2z.org with my local development version of the site ( blocks.wp.a2z ).
This would allow me to create or update content using my iPad or iPhone and pull the changes back to my PC at a later date.
To be able to create/update a whole bunch of content locally, then push it to the slave in a reconciliation process.
This would allow me to install a plugin that delivers blocks and write about each of the blocks then push the completed work to the slave. Doing it this way I’ll have a safety barrier in case anything goes wrong, and visitors won’t need to be presented with Under Construction notices.
To be able to copy content between Multi Sites, so that definitions for blocks registered by plugins such as Jetpack and Yoast SEO are also catalogued in blocks.wp-a2z.org
Proposed solution
- Implement a pull solution between local and slave sites.
- Implement a batch reconciliation process between local and slave sites.
- Implement a pull solution between Multi Site sites.
- Implement an Admin User Interface for manually operated reconciliation with a slave server, including cloning new content.
Status – June 2019
In oik-clone v2.0.0-alpha I implemented a batch reconciliation routine that will detect whether or not content on the slave server needs to be pushed or pulled. It can be run in dry-run
mode, so that I can see which posts will be pushed or pulled.
Prerequisite to this was the development of the logic to implement a pull process between Multi Site sites and batch routines to implement push and pull of content between master and slave server.
I rolled out an alpha version of the plugin to wp-a2z.org, oik-plugins.com and oik-plugins.co.uk, and herbmiller.me.
Status – January 2019
Because I had a feeling that I’ll need to be able to choose whether or not un-cloned posts are cloned I have implemented a manual Admin user interface.
It’s a manual process in that I have to confirm the recommended action.
There may be a few issues if I accidentally overwrite local content that’s been changed but not pushed with content that’s also been changed on the slave. But I have revisions enabled on my post types so I should just be able to restore… so long as I know what I’ve done.
I’m just about to roll out the latest beta version. I will use it to reconcile content that has already been updated on the servers.
Ongoing development
You can follow my development progress in GitHub.
Issue | Reference |
---|---|
Add admin facility to reconcile with a slave server | bobbingwide/oik-clone#49 |
wp_block posts are not immediately clonable using the clone shortcode | bobbingwide/oik-clone#48 |
Map post IDs in block attributes | bobbingwide/oik-clone#38 |
Option for enabling/disabling cloning by post by slave server | bobbingwide/oik-clone#37 |
Add batch facility to perform reconciliation with a slave server | bobbingwide/oik-clone#34 |
Add cloning capability for Taxonomy terms | bobbingwide/oik-clone#32 – not started |
Add batch clone facility for WordPress MultiSite | bobbingwide/oik-clone#31 |
Update MultiSite pull logic for attachments | bobbingwide/oik-clone#29 |
Update oik-clone admin MultiSite tab to use on wp-a2z.org | bobbingwide/oik-clone#28 |
Even though I haven’t developed tests for a lot of the most recent changes, I may close the issues off anway.
Known issues
There are some problems associated with attachments when their parent posts are no longer published
. New issue to be raised.