r51529 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51528‎ | r51529 | r51530 >
Date:02:49, 6 June 2009
Author:tstarling
Status:deferred
Tags:
Comment:
Revert r51200, r51253, r51254, addition of {{NUMBEROFCONTRIBS:...}} parser function. See CodeReview r51200. Not very well implemented and probably a bad idea anyway.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/MagicWord.php (modified) (history)
  • /trunk/phase3/includes/parser/CoreParserFunctions.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/CoreParserFunctions.php
@@ -38,7 +38,6 @@
3939 $parser->setFunctionHook( 'numberingroup', array( __CLASS__, 'numberingroup' ), SFH_NO_HASH );
4040 $parser->setFunctionHook( 'numberofedits', array( __CLASS__, 'numberofedits' ), SFH_NO_HASH );
4141 $parser->setFunctionHook( 'numberofviews', array( __CLASS__, 'numberofviews' ), SFH_NO_HASH );
42 - $parser->setFunctionHook( 'numberofcontribs', array( __CLASS__, 'numberofcontribs' ), SFH_NO_HASH );
4342 $parser->setFunctionHook( 'language', array( __CLASS__, 'language' ), SFH_NO_HASH );
4443 $parser->setFunctionHook( 'padleft', array( __CLASS__, 'padleft' ), SFH_NO_HASH );
4544 $parser->setFunctionHook( 'padright', array( __CLASS__, 'padright' ), SFH_NO_HASH );
@@ -483,7 +482,7 @@
484483 $rev = Revision::newFromTitle($title);
485484 $id = $rev ? $rev->getPage() : 0;
486485 $length = $cache[$page] = $rev ? $rev->getSize() : 0;
487 -
 486+
488487 // Register dependency in templatelinks
489488 $parser->mOutput->addTemplate( $title, $id, $rev ? $rev->getId() : 0 );
490489 }
@@ -505,22 +504,6 @@
506505 $lang = $wgContLang->getLanguageName( strtolower( $arg ) );
507506 return $lang != '' ? $lang : $arg;
508507 }
509 -
510 - /**
511 - * Returns the number of contributions by a certain user. This is an
512 - * expensive parser function and can't be called too many times per page
513 - */
514 - static function numberofcontribs( $parser, $user = null, $raw = null ) {
515 - if ( is_null($user) || !User::isValidUserName( $user ) ) {
516 - return '';
517 - }
518 - if ( !$parser->incrementExpensiveFunctionCount() ) {
519 - return '';
520 - }
521 - $u = User::newFromName( $user );
522 - $id = User::idFromName( $u->mName );
523 - return self::formatRaw( User::edits( $id ), $raw );
524 - }
525508
526509 /**
527510 * Unicode-safe str_pad with the restriction that $length is forced to be <= 500
Index: trunk/phase3/includes/MagicWord.php
@@ -107,46 +107,45 @@
108108
109109 /* Array of caching hints for ParserCache */
110110 static public $mCacheTTLs = array (
111 - 'currentmonth' => 86400,
112 - 'currentmonth1' => 86400,
113 - 'currentmonthname' => 86400,
114 - 'currentmonthnamegen' => 86400,
115 - 'currentmonthabbrev' => 86400,
116 - 'currentday' => 3600,
117 - 'currentday2' => 3600,
118 - 'currentdayname' => 3600,
119 - 'currentyear' => 86400,
120 - 'currenttime' => 3600,
121 - 'currenthour' => 3600,
122 - 'localmonth' => 86400,
123 - 'localmonth1' => 86400,
124 - 'localmonthname' => 86400,
125 - 'localmonthnamegen' => 86400,
126 - 'localmonthabbrev' => 86400,
127 - 'localday' => 3600,
128 - 'localday2' => 3600,
129 - 'localdayname' => 3600,
130 - 'localyear' => 86400,
131 - 'localtime' => 3600,
132 - 'localhour' => 3600,
133 - 'numberofarticles' => 3600,
134 - 'numberoffiles' => 3600,
135 - 'numberofedits' => 3600,
136 - 'currentweek' => 3600,
137 - 'currentdow' => 3600,
138 - 'localweek' => 3600,
139 - 'localdow' => 3600,
140 - 'numberofusers' => 3600,
141 - 'numberofactiveusers' => 3600,
142 - 'numberofpages' => 3600,
143 - 'currentversion' => 86400,
144 - 'currenttimestamp' => 3600,
145 - 'localtimestamp' => 3600,
146 - 'pagesinnamespace' => 3600,
147 - 'numberofadmins' => 3600,
148 - 'numberofviews' => 3600,
149 - 'numberingroup' => 3600,
150 - 'numberofcontribs' => 3600,
 111+ 'currentmonth' => 86400,
 112+ 'currentmonth1' => 86400,
 113+ 'currentmonthname' => 86400,
 114+ 'currentmonthnamegen' => 86400,
 115+ 'currentmonthabbrev' => 86400,
 116+ 'currentday' => 3600,
 117+ 'currentday2' => 3600,
 118+ 'currentdayname' => 3600,
 119+ 'currentyear' => 86400,
 120+ 'currenttime' => 3600,
 121+ 'currenthour' => 3600,
 122+ 'localmonth' => 86400,
 123+ 'localmonth1' => 86400,
 124+ 'localmonthname' => 86400,
 125+ 'localmonthnamegen' => 86400,
 126+ 'localmonthabbrev' => 86400,
 127+ 'localday' => 3600,
 128+ 'localday2' => 3600,
 129+ 'localdayname' => 3600,
 130+ 'localyear' => 86400,
 131+ 'localtime' => 3600,
 132+ 'localhour' => 3600,
 133+ 'numberofarticles' => 3600,
 134+ 'numberoffiles' => 3600,
 135+ 'numberofedits' => 3600,
 136+ 'currentweek' => 3600,
 137+ 'currentdow' => 3600,
 138+ 'localweek' => 3600,
 139+ 'localdow' => 3600,
 140+ 'numberofusers' => 3600,
 141+ 'numberofactiveusers' => 3600,
 142+ 'numberofpages' => 3600,
 143+ 'currentversion' => 86400,
 144+ 'currenttimestamp' => 3600,
 145+ 'localtimestamp' => 3600,
 146+ 'pagesinnamespace' => 3600,
 147+ 'numberofadmins' => 3600,
 148+ 'numberofviews' => 3600,
 149+ 'numberingroup' => 3600,
151150 );
152151
153152 static public $mDoubleUnderscoreIDs = array(
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -340,7 +340,6 @@
341341 'index' => array( 1, '__INDEX__' ),
342342 'noindex' => array( 1, '__NOINDEX__' ),
343343 'numberingroup' => array( 1, 'NUMBERINGROUP', 'NUMINGROUP' ),
344 - 'numberofcontribs' => array( 1, 'NUMBEROFCONTRIBS', 'USERCONTRIBS', 'NUMOFCONTRIBS' ),
345344 'staticredirect' => array( 1, '__STATICREDIRECT__' ),
346345 'protectionlevel' => array( 1, 'PROTECTIONLEVEL' ),
347346 'formatdate' => array( 0, 'formatdate', 'dateformat' ),
Index: trunk/phase3/RELEASE-NOTES
@@ -76,8 +76,6 @@
7777 * (bug 18860) Blocks of IPs affecting registered users can now block email
7878 * (bug 17093) Date and time are separate parameters in Special:BlockList
7979 * (bug 11484) Added ISO speed rating to default collapsed EXIF metadata view
80 -* (bug 19012) Introduce {{NUMBEROFCONTRIBS}} variable to display the number
81 - of contributions a user has.
8280 * (bug 14866) Messages 'recentchangeslinked-toolbox' and
8381 'recentchangeslinked-toolbox' were added to allow more fine grained
8482 customisation of the user interface

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r51200(bug 19012) Added {{NUMBEROFCONTRIBS}} variablesoxred9317:27, 30 May 2009
r51253Some followup to r51200:...mrzman18:55, 31 May 2009
r51254On second thought, use idFromName and edits() instead, load() loads a whole b...mrzman19:06, 31 May 2009

Status & tagging log