r59623 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59622‎ | r59623 | r59624 >
Date:11:53, 1 December 2009
Author:werdna
Status:deferred
Tags:
Comment:
LiquidThreads: Allow threads-per-page to be configured with a configuration variable and a magic word
Modified paths:
  • /trunk/extensions/LiquidThreads/LiquidThreads.php (modified) (history)
  • /trunk/extensions/LiquidThreads/LqtFunctions.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/ParserFunctions.php (modified) (history)
  • /trunk/extensions/LiquidThreads/i18n/LiquidThreads.magic.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/TalkpageView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/LqtFunctions.php
@@ -47,6 +47,11 @@
4848 'useliquidthreads',
4949 array( 'LqtParserFunctions', 'useLiquidThreads' )
5050 );
 51+
 52+ $parser->setFunctionHook(
 53+ 'lqtpagelimit',
 54+ array( 'LqtParserFunctions', 'lqtPageLimit' )
 55+ );
5156
5257 return true;
5358 }
Index: trunk/extensions/LiquidThreads/i18n/LiquidThreads.magic.php
@@ -4,6 +4,7 @@
55
66 $magicWords['en'] = array(
77 'useliquidthreads' => array( 0, 'UseLiquidThreads' ),
 8+ 'lqtpagelimit' => array( 0, 'lqtpagelimit' ),
89 );
910
1011 $magicWords['ar'] = array(
Index: trunk/extensions/LiquidThreads/LiquidThreads.php
@@ -211,3 +211,6 @@
212212
213213 /** Switch this on if you've migrated from a version before around May 2009 */
214214 $wgLiquidThreadsMigrate = false;
 215+
 216+/** The default number of threads per page */
 217+$wgLiquidThreadsDefaultPageLimit = 20;
Index: trunk/extensions/LiquidThreads/classes/ParserFunctions.php
@@ -14,4 +14,10 @@
1515
1616 $parser->mOutput->setProperty( 'use-liquid-threads', $param );
1717 }
 18+
 19+ static function lqtPageLimit( &$parser, $param = null ) {
 20+ if ($param && $param > 0) {
 21+ $parser->mOutput->setProperty( 'lqt-page-limit', $param );
 22+ }
 23+ }
1824 }
Index: trunk/extensions/LiquidThreads/pages/TalkpageView.php
@@ -364,9 +364,21 @@
365365
366366 parent::__construct();
367367
368 - $this->mLimit = 20;
 368+ $this->mLimit = $this->getPageLimit();
369369 }
370370
 371+ function getPageLimit() {
 372+ $article = $this->article;
 373+
 374+ $pout = $article->getParserOutput();
 375+ $setLimit = $pout->getProperty('lqt-page-limit');
 376+
 377+ if ($setLimit) return $setLimit;
 378+
 379+ global $wgLiquidThreadsDefaultPageLimit;
 380+ return $wgLiquidThreadsDefaultPageLimit;
 381+ }
 382+
371383 function getQueryInfo() {
372384 $queryInfo =
373385 array(

Status & tagging log