[pmwiki-users] How to make Site.AllRecentChanges display *all*

Stirling Westrup sti at pooq.com
Fri Nov 17 13:50:07 CST 2006


Lucian Wischik wrote:

> I'd like Site.AllRecentChanges to show *all* recent changes. It should
> make a list out of every historical change to every page (going back
> to a certain date limit), and sort this list.
> 
> Has anyone done something like this? Does it seem like a useful feature?
> Maybe even the useful default behaviour for PmWiki?
> 
> I'm going to start grubbing around in pagelist.php to see if I can
> accomplish it myself. My first impression is that it will involve
> major changes to MakePageList, ones that can't be achieved purely
> inside a local/config.php. It looks like a lot of work, hence why
> I'd like to find that someone else has already done it for me!

That shouldn't be that big a job. I was looking at the code for that on the
weekend and I don't recall that it would be a very big change. Lets see...

Yeah, something along these lines, inserted into config.php should work. It
just replaces the function that saves recent changes with a copy that doesn't
delete the old changes for a page first.

Warning: I haven't tried this out!


str_replace('PostRecentChanges', 'PostAllChanges', $EditFunctions);

function PostAllChanges($pagename,&$page,&$new) {
  global $IsPagePosted, $RecentChangesFmt, $RCDelimPattern, $RCLinesMax;
  if (!$IsPagePosted) return;
  foreach($RecentChangesFmt as $rcfmt=>$pgfmt) {
    $rcname = FmtPageName($rcfmt,$pagename);  if (!$rcname) continue;
    $pgtext = FmtPageName($pgfmt,$pagename);  if (!$pgtext) continue;
    if (@$seen[$rcname]++) continue;
    $rcpage = ReadPage($rcname);
    if (!preg_match("/$RCDelimPattern/",$rcpage['text']))
      $rcpage['text'] .= "$pgtext\n";
    else
      $rcpage['text'] = preg_replace("/([^\n]*$RCDelimPattern.*\n)/",
        "$pgtext\n$1", $rcpage['text'], 1);
    if (@$RCLinesMax > 0)
      $rcpage['text'] = implode("\n", array_slice(
          explode("\n", $rcpage['text'], $RCLinesMax + 1), 0, $RCLinesMax));
    WritePage($rcname, $rcpage);
  }
}






More information about the pmwiki-users mailing list