[wp-trac] [WordPress Trac] #43760: Create a revision when autosaving if the content has changed significantly
WordPress Trac
noreply at wordpress.org
Wed Jun 26 08:10:21 UTC 2019
#43760: Create a revision when autosaving if the content has changed significantly
-------------------------------------------------+-------------------------
Reporter: azaozz | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 5.3
Component: Autosave | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing has-unit- | Focuses:
tests 2nd-opinion |
-------------------------------------------------+-------------------------
Changes (by azaozz):
* keywords: has-patch needs-testing has-unit-tests => has-patch needs-
testing has-unit-tests 2nd-opinion
* milestone: Future Release => 5.3
Comment:
@soulseekah thanks for the alternate patch. Yeah, using text diff will be
more precise but slower, and since this will always run in the background,
making it a bit slower wouldn't matter.
However counting lines may be somehow problematic. It is possible to have
all of post_content on one line which would mean lots of revisions with
minimal changes. Thinking we should be counting something else, perhaps
number of changed places + size of changes, or just added + deleted
characters.
Also thinking it would be good to keep the "sliding scale" based on string
length of post_content. So for longer posts the percentage of changes
would be less. That will catch vases like having a post with 10 paragraphs
and adding another one, vs. having a post with 3 paragraphs and editing
few words in one of them.
Also perhaps the `wp_create_revision_for_autosave_threshold` that filters
the percentage of changes needed to trigger a revision may be a bit of
overkill? Plugins that would want to look there will be able to do
everything they need by using the `wp_create_revision_for_autosave`
filter.
Lets try to add that in 5.3 :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43760#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list