[wp-trac] [WordPress Trac] #20564: Framework for storing revisions of Post Meta
WordPress Trac
noreply at wordpress.org
Wed Apr 3 06:27:28 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 azaozz):
Replying to [comment:49 kovshenin]:
> I took a stab at the `_revision_meta` approach in
[attachment:20564.6.diff] which should keep the meta table clean and small
for revisions. If this works out we can do the same for revisioned terms
(#23893).
Yeah, this works for post formats, not so sure for all meta (only need to
add restoring of the post format from 20564-6.patch, perhaps to the same
array). Still having empty keys in the serialized array seems wasteful :)
As long as we know the post supports formats, we can recreate the empty
keys programmatically, no need to store them in the DB. Example:
{{{
$all_meta = array_merge(
array(
'_wp_format_url' => '',
'_wp_format_quote' => '',
'_wp_format_quote_source' => '',
...
),
get_post_meta( $preview->ID, '_revision_meta', true )
);
}}}
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?
User case:
- User creates a post, no format set.
- User saves a draft creating a revision.
- User edits the post, sets format to quote, enters data in 'url' and
'quote' meta fields.
- User restores to the first revision. At this point do we delete the data
entered in 'url' and 'quote' on the main post or do we keep it? Logically
we should delete it, but if we are keeping all post data ever entered on
the main post, the user may expect to find it if he sets the format to
quote again.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20564#comment:53>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list