[wp-trac] [WordPress Trac] #20564: Framework for storing revisions of Post Meta

WordPress Trac noreply at wordpress.org
Wed Apr 3 07:11:06 UTC 2013


#20564: Framework for storing revisions of Post Meta
-------------------------------------------------+------------------
 Reporter:  alexkingorg                          |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  3.6
Component:  Revisions                            |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing needs-codex  |
-------------------------------------------------+------------------

Comment (by kovshenin):

 Replying to [comment:53 azaozz]:
 > Only need to add restoring of the post format from 20564-6.patch,
 perhaps to the same array.

 That's taxonomy and terms, not post meta, hence the similar patch in
 #23893 for taxonomy. If the the serialized _revision_meta approach works
 well for meta, we can take a similar approach with terms and not "pollute"
 the term_relationships table with relations to revisions :)

 > Still, having empty keys in the serialized array seems wasteful :)

 Maybe. We can indeed check the emptiness of meta before storing their
 revisions to save some space, but I have mixed feelings about it. I don't
 think it will affect post formats all that much, but I keep thinking that
 a non-existent meta value is not the same as a stored empty string,
 especially for multiple values under one key. If there was a `$default`
 argument to `get_post_meta` like there is for `get_option`, not storing
 the empty values would be a deal-breaker. So I lean towards doing
 `delete_post_meta` for empty strings when saving post format metadata.
 Just thinking out loud here.

 > This brings another interesting question: when restoring from a
 revision, do we overwrite all data stored in the main post's formats meta?
 If yes, do empty meta keys from the revision overwrite (i.e. remove) the
 corresponding values on the main post?

 I can try and answer this with a similar question :) When restoring from a
 revision, do empty fields (title or content) overwrite the corresponding
 values in the main post? Create a post with no title, save a few
 revisions, give it a title, save and restore a previous revision: do we
 set the title back to an empty string? The answer is yes, and I think post
 formats (and revisioned post meta in general) should not be any different.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20564#comment:55>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list