WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #16215, comment 69


Ignore:
Timestamp:
03/28/2013 01:53:01 PM (6 years ago)
Author:
adamsilverstein
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #16215, comment 69

    initial v1  
    11Replying to [comment:68 azaozz]:
    22> In 16215-13.patch:
    3 >
    4 > - Always update the revision version when updating the post authors.
    5 > - Check if revisions have been updated and return early in _wp_upgrade_revisions_of_post().
    6 > - Update the revisions by direct query to avoid resetting `post_modified` in wp_update_post() and making all revisions show as saved right now. A lower level API would have been good here :)
    7 > - Removed copying the post to a revision when no revisions exist. Can be added after this conversion if needed.
    8 >
     3>
     4> - Always update the revision version when updating the post authors.
     5> - Check if revisions have been updated and return early in _wp_upgrade_revisions_of_post().
     6> - Update the revisions by direct query to avoid resetting `post_modified` in wp_update_post() and making all revisions show as saved right now. A lower level API would have been good here :)
     7> - Removed copying the post to a revision when no revisions exist. Can be added after this conversion if needed.
     8>
    99
    1010think you still need the wp_save_post_revision( $post->ID ); line (removed in 16215-13.patch), but haven't tested yet. i expect removing it will mess up some data:
    1111
    12 the reason is that under the old system there was no revision matching te current post data, it was always saving the previous, but not the current post. this line adds a copy of the current post as a revision so the last post save data gets stored and can have its author data updated (it will be off initially because the current user might not match the user who made the last changes).
     12the reason is that under the old system there was no revision matching the current post data, it was always saving the previous, but not the current post. this line adds a copy of the current post as a revision so the last post save data gets stored and can have its author data updated (it will be off initially because the current user might not match the user who made the last changes).
    1313
    1414in other words, this call needs to happen before the revisions data is corrected, if we do it after we will have one revision with the wrong author data, or if it doesn't happen before the next update, we will have a gap with one missing revision as the new system saves a revision after the post update occurs so no current data revision will ever get saved.