WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 4 years ago

#9681 closed feature request (fixed)

Add hooks to allow a plugin to support the deletion of unneeded revisions

Reported by: Denis-de-Bernardy Owned by: adamsilverstein
Milestone: 4.4 Priority: low
Severity: minor Version: 2.8
Component: Revisions Keywords: has-patch
Focuses: Cc:
PR Number:

Description

There currently is a means to restore a revision, but no means to delete one.

Attachments (5)

9681.patch (2.4 KB) - added by hakre 11 years ago.
9681.2.patch (2.1 KB) - added by hakre 10 years ago.
9681.diff (1.2 KB) - added by Denis-de-Bernardy 10 years ago.
9681.2.diff (1015 bytes) - added by adamsilverstein 4 years ago.
9681.3.diff (863 bytes) - added by helen 4 years ago.

Download all attachments as: .zip

Change History (36)

#1 @Denis-de-Bernardy
11 years ago

  • Keywords needs-patch added

@hakre
11 years ago

#2 @hakre
11 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 2.8

Looks like this was only forgotten, there was a message called stub in the code and most functionaly already provided with the restore action.

#3 follow-up: @DD32
11 years ago

  • Milestone changed from 2.8 to Future Release

The original intention was to leave all revision-management to a plugin, to let the community decide and develop what was needed, and to eventually integrate the best one out there with Core.

Revision management is something thats needed, But I'm not sure just implementing the delete functionality is a good idea.

I'm moving this to a Future release, Mearly based upon the idea that adding something full blown should be done instead (And its a feature request) - Of course, A committer could come along in a minute and commit it anyway..

That aside, Comments on the patch: Just because revisions are disabled, doesnt mean to say that revisions shouldnt be deleted.

#4 in reply to: ↑ 3 ; follow-up: @hakre
11 years ago

Replying to DD32:

That aside, Comments on the patch: Just because revisions are disabled, doesnt mean to say that revisions shouldnt be deleted.

same for restoring a revision?

#5 @hakre
11 years ago

Some other thought: If you wanna do that by Plugin with a plugable interface: fine (very fine). But that means a change for the restoring action as well. This Patch really is small and oriented to the existing code, so that I do not really see a problem to have it in and to replace it in a further release with a better thought concept.

+1 for having the small patch in for now.

#6 @Denis-de-Bernardy
11 years ago

  • Keywords needs-testing 2nd-opinion added

#7 follow-up: @DD32
11 years ago

  • Keywords dev-feedback added

same for restoring a revision?

Nah, Revisions are disabled, therefor, let them restore any that for some reason, are available.

I think i included a delete option on Revision Control (WP Plugin of mine) - It needs a rewrite, I was planning on something with a better fledged UI.. havnt gotten around to it.

I guess you're right, a minimal patch would be ok, might kick others into making more plugins or suggestions.

I hate to say it, but i do think it has to wait for 2.9, I hate having to draw a line in the sand between which enhancements should be added after a near-feature-freeze (But i dont think we're there yet officially?)

#8 in reply to: ↑ 7 @Denis-de-Bernardy
11 years ago

Replying to DD32:

I hate to say it, but i do think it has to wait for 2.9, I hate having to draw a line in the sand between which enhancements should be added after a near-feature-freeze (But i dont think we're there yet officially?)

dev blog said we were a few weeks back. and then loads of features got tossed in, so...

personally, I'd rather see 2.8 get released in july with all known bugs closed, or nearly so, rather than rushed next month to meet an artificial deadline.

#9 in reply to: ↑ 4 @hakre
11 years ago

Replying to DD32:

same for restoring a revision?

Nah, Revisions are disabled, therefor, let them restore any that for some reason, are available.

just aside comment to the patch: delete action has taken over the same checks then revert action. if you do like to have the revert action available if revisions are disabled, then the trunk must be patched for that. i have just taken over the same piece of code for deleting than it is available for reverting.

#10 @Denis-de-Bernardy
11 years ago

patch works fine, but we might want to add some kind of js confirmation

#11 @Denis-de-Bernardy
11 years ago

  • Keywords tested added; needs-testing 2nd-opinion removed

#12 @Denis-de-Bernardy
11 years ago

  • Milestone changed from Future Release to 2.9

#13 @Denis-de-Bernardy
11 years ago

  • Keywords dev-feedback removed

still applies clean. would be nice if this got committed or rejected before it's stale.

#14 @westi
10 years ago

  • Keywords needs-patch added; has-patch tested removed

This is broken as is.

I get notices for undefined vars on delete - h2 and right_checked

There is not user-experience feedback on the action.

#15 follow-up: @hakre
10 years ago

@westi:

Do you not get notices for undefined vars on restore?

Do you not get a user-experience feddback on the restore-action?

#16 in reply to: ↑ 15 @westi
10 years ago

Replying to hakre:

@westi:

Do you not get notices for undefined vars on restore?

Nope

Do you not get a user-experience feddback on the restore-action?

Yes - it redirects back to the post edit page and you get a message at the top.

e.g. - Post restored to revision from 20 December, 2005 @ 10:50

@hakre
10 years ago

#17 @hakre
10 years ago

  • Keywords has-patch added; needs-patch removed

I updated the patch, it now gives feedback to the user that and which revision has been deleted.

there should be no warnings about undefined variables.

#18 follow-up: @azaozz
10 years ago

Deleting revisions has some security/management implications for multi-user blogs. It breaks the audit trail. Don't think we need any support for that in core even if it doesn't have an UI.

If another hook is needed to allow plugins to implement it easier, lets add it.

#19 in reply to: ↑ 18 @westi
10 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from 2.9 to Future Release
  • Summary changed from Add a button to allow the deletion of unneeded revisions to Add hooks to allow a plugin to support the deletion of unneeded revisions

Replying to azaozz:

Deleting revisions has some security/management implications for multi-user blogs. It breaks the audit trail. Don't think we need any support for that in core even if it doesn't have an UI.

If another hook is needed to allow plugins to implement it easier, lets add it.

Agreed.

If someone wants to cook up a patch for wp_list_post_revisions() to add the required hooks and put together a demo plugin to test with then I will happily commit the required hooks.

Moving to Future for now until that patch exists.

#20 @Denis-de-Bernardy
10 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 3.0

#21 @westi
10 years ago

Not sure the current patch will enable all of it to happen easily in a plugin.

Do we not need a hook in revision.php to make it easy to implement delete?

Also I'm not sure we have an easy obvious hook for handling unknown message ids?

#22 @Denis-de-Bernardy
10 years ago

  • Keywords need-patch added; has-patch removed

k... I guess this'll wait for a better patch then, and a sample plugin.

#23 @miqrogroove
10 years ago

  • Milestone changed from 3.0 to Future Release

#24 @westi
7 years ago

  • Keywords revisions-3.6 added

Adding to the list to consider for the 3.6 revisions work.

#25 @westi
7 years ago

  • Keywords revisions-3.6 removed

For now we are keeping this out of the 3.6 list

#27 @adamsilverstein
4 years ago

  • Keywords has-patch dev-feedback added; need-patch removed
  • Owner set to adamsilverstein
  • Status changed from new to assigned

In [attachement:9681.2.diff]:

  • Add a filter for the actions available in the revisions list meta box (currently none).

This allows plugin authors to add links to end of each line in the revisions list meta box. Although we hide this meta box by default, some users may still prefer this overview of their revisions and want a way to add management features. This hook adds that capability and can be used to resolve the original issue raised in this ticket.

I created a simple plugin demonstrating how this hook can be used : https://github.com/adamsilverstein/wp-post-revision-delete-action

With this patch in place and the plugin active, the meta revisions list gets new Delete options:

http://cl.ly/image/3Z2Q3g1A0P0s/Edit_Post__sadasd__WordPress_2015-09-02_09-12-50.jpg

After deleting the revision, the user sees a confirmation message and revision is gone:

http://cl.ly/image/3L2k2b2k2Y3c/Edit_Post__sadasd__WordPress_2015-09-02_09-13-17.jpg

#28 @helen
4 years ago

  • Keywords needs-patch added; has-patch dev-feedback removed
  • Milestone changed from Future Release to 4.4

These are not my favorite types of hooks to add, but let's figure out where exactly to put this and what to name it (it's not just actions, and the placement is a little awkward) and get it done.

#29 @helen
4 years ago

9681.3.diff is a potential option.

@helen
4 years ago

#30 @DrewAPicture
4 years ago

  • Keywords has-patch added; needs-patch removed

@helen In 9681.3.diff, let's wrap the function name in the description for the $link parameter to a new line and remove the backticks. Otherwise, I like this placement a lot better.

#31 @helen
4 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 34842:

Revisions: Add a wp_post_revision_title_expanded filter.

This allows for content to be added to revision lists, such as in the revisions metabox.

fixes #9681.

Note: See TracTickets for help on using tickets.