I spent the morning with rebuildrecentchanges.inc ...
Background: I had a user who was complaining the watchlist history was too
short. Wikipedia's is 30 days, yet default Mediawiki is only 7 days. This
required changing from $wgRCMaxAge = 7 * 24 * 3600; to $wgRCMaxAge = 30 * 24 *
3600; I could have just left it and said watchlists will appear correct from
now on...but rebuilding the recentchanges table looked tempting.
Bug: After running rebuildrecentchanges.php on a heavily edited wiki, recent
changes appears "empty."
Cause: Debugging found a hard coded limit 5000 in rebuildrecentchanges.inc and
a logic error with the ORDER BY. ORDER BY defaults to an ascending sort with
timestamps. If you hit the hard coded limit, your recent changes table will
only show a few days in the deep past. Ex: If the range was April 23rd to March
23rd, the rebuild only populated the recentchanges table from March 23rd to
March 29th. Expected behavior would be that it would populate from April 23rd
back until it hit either the limit or time() - $wgRCMaxAge.
- Add DESC to ORDER BY: array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' =>
- Raise Limit: array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => 100000 )
- or Eliminate Limit: array( 'ORDER BY' => 'rev_timestamp DESC' )
- Default $wgRCMaxAge = 7 * 24 * 3600; is a bit low, suggest $wgRCMaxAge = 60 *
24 * 3600; which is twice the Wikipedia setting.