r103382 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103381‎ | r103382 | r103383 >
Date:21:00, 16 November 2011
Author:bawolff
Status:ok (Comments)
Tags:
Comment:
(bug 11685) - Make DynamicPageList limit parser cache to 24 hours by default (configurable) on pages using it's tag.

I think 24 hours is sane, but this should definitly be reviewed by someone familar with performance-y stuff before it gets deployed to make sure it won't blow things up.

(The reason for doing this is DPL does queries of categories, but doesn't check if those categories change, so in extreme cases it could have outdated dpl results on a page for several weeks. In practise this is rarely an issue (on enwikinews anyways), but does cause problems in certain circumstances.)
Modified paths:
  • /trunk/extensions/intersection/DynamicPageList.php (modified) (history)

Diff [purge]

Index: trunk/extensions/intersection/DynamicPageList.php
@@ -54,11 +54,16 @@
5555 // Parser tests
5656 $wgParserTestFiles[] = $dir . 'DynamicPageList.tests.txt';
5757
58 -# Configuration variables
 58+# Configuration variables. Warning: These use DLP instead of DPL
 59+# for historical reasons (pretend Dynamic list of pages)
5960 $wgDLPmaxCategories = 6; // Maximum number of categories to look for
6061 $wgDLPMaxResultCount = 200; // Maximum number of results to allow
6162 $wgDLPAllowUnlimitedResults = false; // Allow unlimited results
6263 $wgDLPAllowUnlimitedCategories = false; // Allow unlimited categories
 64+// How long to cache pages using DPL's in seconds. Default to 1 day. Set to
 65+// false to not decrease cache time (most efficient), Set to 0 to disable
 66+// cache altogether (inefficient, but results will never be outdated)
 67+$wgDLPMaxCacheTime = 60*60*24; // How long to cache pages
6368
6469 $wgHooks['ParserFirstCallInit'][] = 'wfDynamicPageList';
6570 /**
@@ -73,12 +78,16 @@
7479 }
7580
7681 // The callback function for converting the input text to HTML output
77 -function renderDynamicPageList( $input ) {
 82+function renderDynamicPageList( $input, $args, $mwParser ) {
7883 global $wgUser, $wgContLang;
7984 global $wgDisableCounters; // to determine if to allow sorting by #hits.
80 - global $wgDLPmaxCategories, $wgDLPMaxResultCount;
 85+ global $wgDLPmaxCategories, $wgDLPMaxResultCount, $wgDLPMaxCacheTime;
8186 global $wgDLPAllowUnlimitedResults, $wgDLPAllowUnlimitedCategories;
8287
 88+ if ( $wgDLPMaxCacheTime !== false ) {
 89+ $mwParser->getOutput()->updateCacheExpiry( $wgDLPMaxCacheTime );
 90+ }
 91+
8392 $countSet = false;
8493
8594 $startList = '<ul>';

Follow-up revisions

RevisionCommit summaryAuthorDate
r107970MFT r100516, r103260, r103315, r103378, r103382, r104862reedy00:08, 4 January 2012

Comments

#Comment by Bawolff (talk | contribs)   00:24, 17 November 2011

Tagging 1.18wmf1 since Dario Taraborelli wants this [1]

Status & tagging log