-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add batch facility to perform reconciliation with a slave server #34
Comments
To assist in the development and testing I need to improve the error reporting capability in the |
There's a problem with implementing the reconciliation with the current data. When a post is cloned the cloned date is set to the post_modified_gmt of the post being cloned. A pragmatic workaround may be to allow for up to a minute's difference between timestamps. |
The first pass routine uses an updated version of the request_mapping logic ( from class-oik-clone-reset-ids.php ) to obtain the mapping for the slave, returning the cloned timestamp and the post_modified_gmt of the slave post. This is then matched with the original post and the post_modified_gmt timestamps compared. The rather verbose output reports what might need to be done. |
The latest version performs a basic pull from a remote server ( not a WPMS site ) with some limitations
|
Since this is a major change the new version will need to be 2.0.0. |
Re: #34 (comment)
The logic has now been changed to reset the cloned timestamp on the master after performing the pull, setting it to the original cloned date. |
The logic that requests the mappings on the server should take into account the fact that a post may have been cloned to multiple targets, which may have happened inadvertently. It would appear that the inadvertent cloning to a new post is also producing a Warning:
|
A better fix to this is to implement the There will still be problems after a pull. The cloned dates need to be adjusted on both the master and the server. |
For attachments we also need to filter |
For pulling attachments, we need to consider what happens to the attached files. This should only become a problem when an image (or other file type ) has been uploaded directly to the server to create new content - i.e. not cloned. ... and the code does not yet cater for this situation. |
…st_modified and post_modified_gmt
To resolve this problem we add a subsequent AJAX request that updates the cloned information on the slave server to reflect fact that the master post, that has been pulled into the target, now has a new cloned timestamp equivalent to the post_modified_gmt. The AJAX request is
With the changes for the It may be possible to use this new AJAX request to resolve the mismatches. |
When there are a lot of posts the Then, once we know what sort of changes will be made we can run the reconciliation with Also add logic to determine which post types to clone, enabling the order to be chosen. Here are a couple of basic .bat routines to start with:
reconcile.bat - the real mccoy
These routines will need to be parameterised / copied & cobbled for cloning from |
In order to properly perform reconciliation we need to be able to list all the cloneable content on the slave, and pull any content that's missing to the master. This query to list the posts needs to take into account attachments, which may have a status of Note: This logic may end up pulling posts that were deleted from the master but not from the slave. |
Having applied a couple of fixes, I've now alpha tested v2.0.0-alpha-20190602 with my local system blocks.wp.a2z as the master and https://blocks.wp-a2z.org as the slave.
Importing of attachments seemed to duplicate content. |
Re:
and
Because the attachments were attached to Similarly, I imagine this applies to the parent post. What should happen when a local post is not |
Once all the slave posts have been dealt with we should then turn to all the master posts that have been published but not yet cloned. The question is... do I really want to have the system cloning every published post to the selected slave during reconciliation? In the case of a set of new block CPTs having been created for a plugin then it would be nice to have the whole lot cloned in one fell swoop, especially if there are a lot of them. |
Even when |
oik-clone v2.0.0 has been released. Closing this issue even though there are no PHPUnit tests. "Life's too short to not be flippant sometimes" |
With the current logic I'm loathe to change content on a slave since this is not reflected in the master. I want to be able to reconcile changes applied to a slave to the original master.
The text was updated successfully, but these errors were encountered: