RebuildRC

Summary: Rebuild (All)RecentChanges pages either after a format change, an import or to remove spam.
Version: 20191125
Prerequisites:
Status: Experimental
Maintainer: Petko
License: GPLv3+
Users: (view? / edit)
Discussion: RebuildRC-Talk?

Description

Rebuild (All)RecentChanges pages either after a format change, an import or to remove spam.

The function reads all pages from the wiki and regenerates Site.AllRecentChanges and all *.RecentChanges pages from the metadata of the wiki pages (last modified times, authors, change summaries).

Installation

Place rebuild-rc.phpΔ into your pmwiki/cookbook directory and add to config.php this line:
if ($action == 'rebuild-rc')
  include_once("cookbook/rebuild-rc.php");

If you have many pages, the regeneration may take a long time and need a lot of memory and hit a system limit. If the script crashes, see Cookbook:SystemLimits on how to increase the memory and time limits. You should also do this when the server and the filesystem are not under heavy load with many visits at once.

If you have different per-group recent changes configuration, you need to manually configure the recipe and run it inside the specific groups. For example, if you have groups "Private" and "Admin" and have disabled the Site.AllRecentChanges for these groups, you need to do the following:

  1. in config.php, remove the private groups from the processing:
    $RebuildRCPattern = '*.*,-Private.*,-Admin.*,-*.RecentChanges,-*.AllRecentChanges';
    
    the page patterns are like those used in pagelists -- here we define all pages (*.*) except all in the Private group (-Private.*) or the Admin group (-Admin.*), or any RecentChanges page itself
  2. your files local/Private.php and local/Admin.php probably already contain the first line to disable AllRecentChanges, add the second line:
    unset($RecentChangesFmt['$SiteGroup.AllRecentChanges']);
    $RebuildRCPattern = 'Private.*,-*.RecentChanges,-*.AllRecentChanges';
    # replace 'Private.*' with 'Admin.*' in local/Admin.php
    
  3. open in your browser one after another:
    1. pmwiki.php?action=rebuild-rc
    2. pmwiki.php?n=Admin.HomePage&action=rebuild-rc
    3. pmwiki.php?n=Private.HomePage&action=rebuild-rc

Notes

  • The recipe is still experimental, make sure you have backups before running it. Please report any difficulties.
  • Only pages that currently exist will be included in the new RecentChanges -- previously deleted pages will not appear.
  • The modified (All)RecentChanges pages should store a diff in the page history so in case the new version is not what you expect, you should be able to restore the previous content. Or from your backups.
  • $EnableRCDiffBytes is not supported (the difference in bytes will not appear in the new recent changes).
  • $RecentUploadsFmt is not supported (recent uploads will not appear in the new recent changes).
  • $RCLinesMax is not supported (all pages will appear in the RecentChanges, only a subsequent page edit will use $RCLinesMax).
  • The recipe will generate RecentChanges pages even for WikiGroups that exist but that have not had edits on your wiki, like the core documentation or the Site group, or for imported pages that have never been edited. To exclude some of these, you can set in config.php the variable $RebuildRCPattern to something like:
    $RebuildRCPattern = '*.*,-PmWiki*.*,-Site*.*,-Category.*,-*.RecentChanges,-*.AllRecentChanges'; 
    

Usage

Read the Notes first.

As a wiki administrator, open pmwiki.php?action=rebuild-rc. You will see a list of the newly generated RecentChanges pages.

To do / some day / maybe

Some day, if there is funding:

  • When there are a huge number of pages, allow the recipe to collect the data in a several steps without crashing.
  • Find a way or a switch to only list pages that were actually modified in the current wiki, excluding those in wikilib.d.

Change log / Release notes

  • 20191125 First public release, ready to be tested.

See also

Cookbook /
LocalTimes  Display RecentChanges and History timestamps in the local timezone of each visitor. (Beta)
PendingChanges  Browser and desktop notifications for page changes (Experimental)
RecentChangesDeletion  Allow authors to delete RecentChanges pages, there-by making it possible for authors to delete wiki groups.
SpamFilters  Automatic blocking of some spambots (beta)
SystemLimits  Ways to increase various memory and filesize limits for a PmWiki installation

Contributors

  • Written and maintained by Petko.

Comments

See discussion at RebuildRC-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.