The MU forums have moved to WordPress.org

Limiting post revisions (21 posts)

  1. selad
    Member
    Posted 15 years ago #

    One of the new features in WordPress 2.6 (including MU) is post revisions. This is nice but I'm somewhat concerned with the implications. A post revision is saved to the wp_posts table every time the user saves a draft.

    Does anyone have an estimate for the average number of draft saves? I make just a few saves for each post I write. What effect will this have on the database size and performance when there are 50K users?

    Can one turn off this feature by adding the following to the config file:
    define('WP_POST_REVISIONS', false);

    I’m also not sure if a revision is saved via the autosave process?

  2. Ovidiu
    Member
    Posted 15 years ago #

    maybe this plugin works? I haven't tried it with wpmu, just found it yesterday...

    http://wordpress.org/extend/plugins/mg-advancedoptions/

  3. selad
    Member
    Posted 15 years ago #

    Thanks Ovidiu.

    I'm still not that I want to turn if off. Maybe limit the number of revisions like:
    define('WP_POST_REVISIONS', 3); // max. 3 revisions

    or maybe just delete the revisions once the the post is published (or a few days later).

  4. musnake
    Member
    Posted 15 years ago #

    In wp-includes/post.php @ line 3182:

    // WP_POST_REVISIONS = (int) (# of autasaves to save)
    	$delete = count($revisions) - WP_POST_REVISIONS;

    Smells like chicken.

  5. TimePeak
    Member
    Posted 15 years ago #

    musnake, should these strings be added to post.php?
    Cause actually my post.php file is 2982 lines long, and it doesn't contain anything like WP_POST_REVISIONS

  6. lunabyte
    Member
    Posted 15 years ago #

    No, they shouldn't be added.

    They exist in 2.6, which is what this is all discussing.

  7. TimePeak
    Member
    Posted 15 years ago #

    oh, I see. I'm still on 1.5.1 :)

  8. Ovidiu
    Member
    Posted 15 years ago #

    btw. the plugin I linked to above, can either disable or limit the post revisions to a certain number of revisions.

  9. mrarrow
    Member
    Posted 15 years ago #

    I've installed this plugin on WPMU 2.6 and all it seems to do is hide the 'Post revisions' tab at the bottom of each write post page. This is nowhere near as useful, as revised posts are still being created in MySQL, hence the tables will continue to get bigger and bigger.

    When you look in MySQL revised posts are flagged as post_status='inherit' (rather than post_status='publish').

    It would be much neater to be able to kill any revisions from being created in the first place.

  10. musnake
    Member
    Posted 15 years ago #

    How about this:

    http://wordpress.org/extend/plugins/revision-control/

    Author: Dion Hulse

    Revision Control is a plugin for WordPress 2.6+ which gives the user more control over the Post/Page Revisions.

    The plugin allows the user to set a blog-global setting (Settings -> Revisions) for pages/posts to enable/disable/limit the number of revisions which are saved for the page/post. The user may change this setting on a per-page/post basis from the Revisions Meta box.

    The plugin also allows the deletion of specific revisions via the Revisions post metabox.

  11. mrarrow
    Member
    Posted 15 years ago #

    Excellent - well spotted! Having installed it in the plugins folder, initial results seem to completely kill any revisions being created. Perfect, even though the authors site says it wasn't written for WPMU!

  12. dsader
    Member
    Posted 15 years ago #

    I mashed together a specifically wpmu/site-wide version. Enable/disable post revisions in SiteAdmin-->Options

    http://wpmudevorg.wordpress.com/project/Limit-Post-Revisions

  13. mrarrow
    Member
    Posted 15 years ago #

    Oh my, that looks good as well although I haven't installed it as the other one is working at the moment.

    Dsader:, when you say site-wide do you mean across the whole MU installation or just top down from specific top level domains?

    Coz quite frankly, I'm not keen on allowing anyone to have access to previous revisions, especially when it writes each revision to the database. So it'd be cool to switch it off globally, or at least one switch for the whole of a domain.

  14. dsader
    Member
    Posted 15 years ago #

    "site-wide"
    One SiteAdmin-->Option to set and poof no more revisions, ... anywhere.

  15. musnake
    Member
    Posted 15 years ago #

    Thanks man.

    I guess line 43 echo 'huh?'.$number; is an artifact...

  16. dsader
    Member
    Posted 15 years ago #

    Oops, too much chicken.

  17. SteveAtty
    Member
    Posted 15 years ago #

    So this stops new ones from being created but does it ever get rid of the old ones or do we need to manual clear up what has already been created?

  18. boonika
    Member
    Posted 15 years ago #

    add this code somewhere inside wp-config.php to remove post revisions (source: http://lesterchan.net/wordpress/2008/07/17/how-to-turn-off-post-revision-in-wordpress-26/)

    ---------------------------------------

    define('WP_POST_REVISIONS', false);

  19. VentureMaker
    Member
    Posted 15 years ago #

    Do only posts have revisions in WPMU? What about pages, links, etc?

  20. VentureMaker
    Member
    Posted 15 years ago #

    bump :)

  21. andrea_r
    Moderator
    Posted 15 years ago #

    Posts & pages have revisions, nothing else does.

    pages are just special posts.

    (that's why it's called "post revisions" ;p )

About this Topic