r62527 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62526‎ | r62527 | r62528 >
Date:16:50, 15 February 2010
Author:dale
Status:ok (Comments)
Tags:
Comment:
Updated per r62197 #c5705 ( include enableparser param and support both msg args replace with or without parser enabled )
Modified paths:
  • /branches/js2-work/phase3/includes/api/ApiQueryAllmessages.php (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/includes/api/ApiQueryAllmessages.php
@@ -80,10 +80,15 @@
8181 if($skip && $message === $params['from'])
8282 $skip = false;
8383 if(!$skip) {
84 -
8584 $a = array( 'name' => $message );
86 - if( isset( $params['arg'] ) && count( $params['arg'] ) != 0 ){
87 - $msg = wfMsgExt( $message, array( 'parsemag' ), $params['arg'] );
 85+ if( isset( $params['args'] ) && count( $params['args'] ) != 0 ){
 86+ // Check if the parser is enabled:
 87+ if( $params[ 'enableparser' ] ){
 88+ $msg = wfMsgExt( $message, array( 'parsemag' ), $params['args'] );
 89+ } else {
 90+ $msgString = wfMsgGetKey( $message, true, false, false );
 91+ $msg = wfMsgReplaceArgs( $msgString, $params['args'] );
 92+ }
8893 }else{
8994 $msg = wfMsgGetKey( $message, true, false, false );
9095 }
@@ -123,7 +128,8 @@
124129 'default'
125130 )
126131 ),
127 - 'arg' => array(
 132+ 'enableparser' => false,
 133+ 'args' => array(
128134 ApiBase :: PARAM_ISMULTI => true
129135 ),
130136 'filter' => array(),
@@ -136,7 +142,10 @@
137143 return array (
138144 'messages' => 'Which messages to output. "*" means all messages',
139145 'prop' => 'Which properties to get',
140 - 'arg' => 'Arguments to be substituted into msg',
 146+ 'enableparser' => 'Set to enable parser, will parses the wikitext of message \n' .
 147+ 'Will substitute magic words, handle templates etc.',
 148+ 'args' => 'Arguments to be substituted into message. \n' .
 149+ 'Will replace $1, $2 with values. ( values are \'|\' separated )',
141150 'filter' => 'Return only messages that contain this string',
142151 'lang' => 'Return messages in this language',
143152 'from' => 'Return messages starting at this message',

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r62197* bug 22453, adds support for arguments to be substituted into msgs. Enables ...dale21:24, 9 February 2010

Comments

#Comment by Catrope (talk | contribs)   17:32, 15 February 2010
+			'enableparser' => 'Set to enable parser, will parses the wikitext of message \n' .
+							  'Will substitute magic words, handle templates etc.',

Use array( 'line1', 'line2' ) instead.

( values are \'|\' separated )',

That's an API-wide convention, and the help page generator will automatically append a message about this.

#Comment by Mdale (talk | contribs)   17:50, 15 February 2010

oky r62530

Status & tagging log