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 facility to reload cloning information on an imported database #17

Open bobbingwide opened 7 years ago

bobbingwide commented 7 years ago

If a local site that is being cloned to multiple targets is re-imported from the main slave site, and the cloning information is reset using the solution for #16 then the cloning information for other slaves is lost. It would be nice if this information could be rediscovered and reconciled, as this would make cloning of updates much easier.

Proposed solution

For each post type where cloning is supported:

The slave stores the original post information in a serialised array under meta_key _oik_clone_ids - the same key name as on the client. For each host, depending on the version of oik-clone used when the post was cloned, the data is stored either as the post ID

a:1:{s:16:"http://qw/oikcom";i:5398;}

or, for later versions, as a keyed array: id and cloned

a:1:{s:16:"http://qw/oikcom";a:2:{s:2:"id";i:7976;s:6:"cloned";i:1362926995;}}

The slave therefore needs to return a JSON array something like this: master: ID, slave: ID, cloned: timestamp

It would be nice if the slave to which the request is sent is also a local clone. It depends on how much processing time is required. oikwp class-oik-clone-reset-ids.php slave