• Resolved Georgio

    (@georgio-1)


    Hi,

    Thanks for this excellent plugin! It works well but there is no possibility to exclude revisions from deletion. There are cases where revisions count, for example when using a collaborative tool. I use Buddypress Docs for translations
    https://wordpress.org/plugins/buddypress-docs/
    This tool allows multi-edition and some times it is important to restore a previous revision in case the new editor has made mistakes. There is a history page to see who did what and it is very important to know who edited your text. It is also a way to know which editors are the best and which are not serious and should be blocked from editing.

    When optimizing the database, all the history is lost. So I have set the settings to 90 days for 50 revisions, but that doesn’t resolve really the problem.

    Any idea ? if any post had an option “keep revisions” it would be perfect but maybe it is a lot of work to implement….

    https://wordpress.org/plugins/rvg-optimize-database/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor cageehv

    (@cageehv)

    Hey Georg.io,

    Thanks for your suggestion!

    I will have a look at it and see how hard it is to implement such an option.

    peace,
    Rolf

    Plugin Contributor cageehv

    (@cageehv)

    Hey Georg.io,

    Just released version 4.1.4 of my plugin.

    Now you can add a custom field (‘keep_revisions’, ‘Y’) to the posts and pages of which you want to keep the revisions.

    Enjoy!

    peace,
    Rolf

    Thread Starter Georgio

    (@georgio-1)

    Hi,

    a priori that’s good news! I will try to find a way to use it, though it is not obvious.
    Unfortunately Buddypress Docs doesn’t have custom fields feature. Regular posts and pages have that feature of course, but for a reason I ignore, this feature shows only options from A to F (I tested with two themes) so I don’t see ‘keep_revisions’. Even if I add it manually I cannot test it for a regular post as your plugin will remove the revisions of Buddypress Docs as well.

    I will search for a plugin in order to add custom fields to Buddypress Docs.

    Indepentently from the results, thanks for your work.

    A custom field (ie, a piece of postmeta) is a good way to skip specific posts, but it’s not good for broad categories – the ‘Y’ would need to be filled in each time, making it hard to do programatically, especially with existing content.

    If a filter were added to rvg-optimize-database, it would be very easy to write a small plugin that would exclude certain types of posts from having their revisions cleaned. In ODB_Cleaner, change odb_post_is_excluded() so it looks like this:

    function odb_post_is_excluded($parent_id)
    	{
    		$keep_revisions = get_post_meta($parent_id, 'keep_revisions', true);
    		return apply_filters( 'odb_post_is_excluded', ($keep_revisions === 'Y'), $parent_id );;
    	} // odb_post_is_exclude()

    Then, @georgio-1 can exclude Docs from the cleaner like this:

    function exclude_buddypress_docs_from_odb_cleaner( $is_protected, $parent_id ) {
        $parent = get_post( $parent_id );
        if ( $parent && bp_docs_get_post_type_name() === $parent->post_type ) {
            $is_protected = true;
        }
    
        return $is_protected;
    }
    add_filter( 'odb_post_is_excluded', 'exclude_buddypress_docs_from_odb_cleaner', 10, 2 );
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Exclude revisions’ is closed to new replies.