#24782 closed defect (bug) (fixed)
Revisions: Re-think the way how the current revision is detected
Reported by: | ocean90 | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.6 | Priority: | normal |
Severity: | normal | Version: | 3.6 |
Component: | Revisions | Keywords: | has-patch commit 2nd-opinion |
Focuses: | Cc: |
Description
To detect if a revision is the current one we do $revision->post_modified_gmt === $post->post_modified_gmt
, see trunk/wp-admin/includes/revision.php:24708#L102.
This can be an issue if you are using the API and creating revisions programmatically which can result in same timestamps, since we doesn't save milliseconds, only seconds.
We noticed this while the GSoC project "Code revisions", see #gsoc326 and on make/core.
Not sure if we can do something here, but want to make it known.
Attachments (3)
Change History (9)
#2
@
11 years ago
- Keywords has-patch added
- Milestone changed from Awaiting Review to 3.6
- Version set to trunk
24782.2.diff works for me. Tested with Code Revisions and some test posts. Works also with an autosave as latest revision.
#3
@
11 years ago
- Keywords commit 2nd-opinion added; dev-feedback removed
Works also with an autosave as latest revision.
24782.3.diff tries to make absolutely sure that an autosave will not accidentally be considered to be the current revision. Some odd set of closely timed events, I guess, could cause this.
#5
@
11 years ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In 24730:
#6
@
11 years ago
Note:
// If a post has been saved since the last revision (no revisioned fields were changed) // we may not have a "current" revision. Mark the latest revision as "current". if ( empty( $current_id ) ) $revisions[ $revision->ID ]['current'] = true;
... being added in #24804 (first appearance is .9.diff).
fixes typo