Index: trunk/extensions/intersection/DynamicPageList.php |
— | — | @@ -54,11 +54,16 @@ |
55 | 55 | // Parser tests |
56 | 56 | $wgParserTestFiles[] = $dir . 'DynamicPageList.tests.txt'; |
57 | 57 | |
58 | | -# Configuration variables |
| 58 | +# Configuration variables. Warning: These use DLP instead of DPL |
| 59 | +# for historical reasons (pretend Dynamic list of pages) |
59 | 60 | $wgDLPmaxCategories = 6; // Maximum number of categories to look for |
60 | 61 | $wgDLPMaxResultCount = 200; // Maximum number of results to allow |
61 | 62 | $wgDLPAllowUnlimitedResults = false; // Allow unlimited results |
62 | 63 | $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 |
63 | 68 | |
64 | 69 | $wgHooks['ParserFirstCallInit'][] = 'wfDynamicPageList'; |
65 | 70 | /** |
— | — | @@ -73,12 +78,16 @@ |
74 | 79 | } |
75 | 80 | |
76 | 81 | // The callback function for converting the input text to HTML output |
77 | | -function renderDynamicPageList( $input ) { |
| 82 | +function renderDynamicPageList( $input, $args, $mwParser ) { |
78 | 83 | global $wgUser, $wgContLang; |
79 | 84 | global $wgDisableCounters; // to determine if to allow sorting by #hits. |
80 | | - global $wgDLPmaxCategories, $wgDLPMaxResultCount; |
| 85 | + global $wgDLPmaxCategories, $wgDLPMaxResultCount, $wgDLPMaxCacheTime; |
81 | 86 | global $wgDLPAllowUnlimitedResults, $wgDLPAllowUnlimitedCategories; |
82 | 87 | |
| 88 | + if ( $wgDLPMaxCacheTime !== false ) { |
| 89 | + $mwParser->getOutput()->updateCacheExpiry( $wgDLPMaxCacheTime ); |
| 90 | + } |
| 91 | + |
83 | 92 | $countSet = false; |
84 | 93 | |
85 | 94 | $startList = '<ul>'; |