r39262 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39261‎ | r39262 | r39263 >
Date:01:23, 13 August 2008
Author:alnokta
Status:old
Tags:
Comment:
Add optional feature. now if mediawiki:newusermessage-signs exists and contains a list of user names (* [[signature]] newline * etc...), these user names will be added after the template (randomly) along with the date & time. Patch by AhmadSherif.
Modified paths:
  • /trunk/extensions/NewUserMessage/NewUserMessage.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/NewUserMessage/NewUserMessage.class.php
@@ -53,8 +53,20 @@
5454 $dbw = wfGetDB( DB_MASTER );
5555 $dbw->begin();
5656 $good = true;
 57+
 58+ $signs = wfMsgForContent('newusermessage-signs');
 59+ if (!wfEmptyMsg('newusermessage-signs', $signs)) {
 60+ $pattern = '/^\* ?(.*?)$/m';
 61+ preg_match_all($pattern, $signs, $signsList, PREG_SET_ORDER);
 62+ $rand = rand(0, count($signsList)-1);
 63+ $sign = $signsList[$rand][1];
 64+ }
5765 try {
58 - $article->doEdit("{{{$templateTitleText}|$name}}", wfMsgForContent( 'newuseredit-summary' ), $flags);
 66+ if (!wfEmptyMsg('newusermessage-signs', $signs)) {
 67+ $article->doEdit("{{{$templateTitleText}|$name}}\n--" . $sign . "~~~~~" , wfMsgForContent( 'newuseredit-summary' ), $flags);
 68+ } else {
 69+ $article->doEdit("{{{$templateTitleText}|$name}}", wfMsgForContent( 'newuseredit-summary' ), $flags);
 70+ }
5971 } catch ( DBQueryError $e ) {
6072 $good = false;
6173 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r39294* Refactored r39262...tstarling16:20, 13 August 2008

Status & tagging log