Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

Limit Diffs per page

Summary: Paginate the "diff" output (when viewing a page history, limit the number of displayed revisions at once)
Version: 2007-11-20
Prerequisites: PmWiki post-March 2006.
Status: Stable
Maintainer: Petko

See the bottom line.

Questions answered by this recipe

Is there a possibility to display a smaller number of revisions, on a number of sub-pages?

Description

A page history can become quite big, as seen on pmwiki.org. When you then take a look at the history, it takes quite some time. This recipe displays a smaller number of revisions, on a number of sub-pages.

This is a conversion of my fix, supplied at PITS.00544, into an independent recipe. The distribution file scripts/pagerev.php is replaced on the fly by the provided patched script.

Installation

  1. Copy the file limitdiffsperpage.phpΔ to your /cookbook/ directory.
  2. Set in your (farm)config.php the following code:
if ($action=='diff')
{
   $DiffCountPerPage = 10; # Optional
   include_once("$FarmD/cookbook/limitdiffsperpage.php");
}
Note: PmWiki had a bug while handling the & entity. It was fixed in version 2.2beta64. If you're using an older version of PmWiki, you should download the previous version instead: limitdiffsperpage-old.phpΔ. (The old version is only needed if you want to validate the output. However, PmWiki post-2.2.beta64 need the new version 2007-11-20.)

Configuration

The one and only configuration variable is $DiffCountPerPage. You can set it to the number of revisions that will be displayed on every page:

   $DiffCountPerPage = 4;  # show 4 revisions
   $DiffCountPerPage = 10; # show 10 revisions (recipe default)
   $DiffCountPerPage = 0;  # show all revisions, like PmWiki

Notes

Using this recipe to display diffs is never slower than the original pagerev.php, but it can be drastically faster, especially on pages with long revision history.

The patched file was submitted in March 2006, and as of pmwiki-2.2.0-beta64 (2007-11-13) it is still up-to-date and working (the original file scripts/pagerev.php did not change since then).

The script has been tested for a long time and should work fine.

Release Notes

  • 2007-11-20: Changed to work with 2.2.beta64 and newer. Renamed all functions just in case a field loads another diff recipe than the wikifarm.

See Also

Contributors

  • Pm is the author of the original scripts/pagerev.php
  • Petko proposed the patch and is maintaining this recipe.

Comments

Edit - History - Print - Recent Changes - Search
Page last modified on February 02, 2008, at 07:56 PM