r112561 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112560‎ | r112561 | r112562 >
Date:01:56, 28 February 2012
Author:krinkle
Status:ok (Comments)
Tags:hashar 
Comment:
[IRC Log Message] Fix for protect/protect and protect/modify

* protect/protect and protect/modify were still failing because the output on IRC is not matching the i18n messages. The bots look for comment.match(<i18n-message> + (optionally) followed by ": user comment").
* The problem with protect/protect and protect/modify is that the protection settings are also inserted in somewhere in the message. Before MediaWiki 1.19 these were included in the IRC message as part of $1 (title). That may be ugly, but that's how it has always been. Since the point is to reproduce the old output we need to fix this one as well. This will make the output like:

Krinkle * protected "[[Sandbox [edit=autoconfirmed)]]"

which is exactly how it has been before and that's the the bots rely on (which was presumably done originally like that since it was the only way to make the output match the i18n message)

* Fixes more bug 34508
Modified paths:
  • /trunk/phase3/includes/logging/LogFormatter.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/RecentChangeTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/logging/LogFormatter.php
@@ -226,6 +226,20 @@
227227 }
228228 break;
229229
 230+ case 'protect':
 231+ switch( $entry->getSubtype() ) {
 232+ case 'protect':
 233+ $text = wfMsgExt( 'protectedarticle', $msgOpts, $target . ' ' . $parameters[0] );
 234+ break;
 235+ case 'unprotect':
 236+ $text = wfMsgExt( 'unprotectedarticle', $msgOpts, $target );
 237+ break;
 238+ case 'modify':
 239+ $text = wfMsgExt( 'modifiedarticleprotection', $msgOpts, $target . ' ' . $parameters[0] );
 240+ break;
 241+ }
 242+ break;
 243+
230244 case 'newusers':
231245 switch( $entry->getSubtype() ) {
232246 case 'newusers':
Index: trunk/phase3/tests/phpunit/includes/RecentChangeTest.php
@@ -161,12 +161,15 @@
162162 * @covers LogFormatter::getIRCActionText
163163 */
164164 function testIrcMsgForLogTypeProtect() {
 165+ $protectParams = array(
 166+ '[edit=sysop] (indefinite) ‎[move=sysop] (indefinite)'
 167+ );
165168
166169 # protect/protect
167170 $this->assertIRCComment(
168 - wfMessage( 'protectedarticle', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
 171+ wfMessage( 'protectedarticle', 'SomeTitle ' . $protectParams[0] )->plain() . ': ' . $this->user_comment,
169172 'protect', 'protect',
170 - array(),
 173+ $protectParams,
171174 $this->user_comment
172175 );
173176
@@ -180,9 +183,9 @@
181184
182185 # protect/modify
183186 $this->assertIRCComment(
184 - wfMessage( 'modifiedarticleprotection', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
 187+ wfMessage( 'modifiedarticleprotection', 'SomeTitle ' . $protectParams[0] )->plain() . ': ' . $this->user_comment,
185188 'protect', 'modify',
186 - array(),
 189+ $protectParams,
187190 $this->user_comment
188191 );
189192 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r1125701.19wmf1: MFT r111983, r112384, r112451, r112561, r112562, r112567catrope02:55, 28 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112042Part 1 for bug 34508, commit all the messages added in patch 3reedy21:12, 21 February 2012
r112045First merge of the rest of the code from bug 34508 patch 1 and patch 3reedy21:26, 21 February 2012
r112061Bug 34508 - [Regression] IRC string output for log messages no longer compatible...reedy23:38, 21 February 2012
r112128r112045/bug 34508: Make upload/upload and overwrite match old IRC formatrobla18:29, 22 February 2012
r112415basic tests for bug 34508hashar21:22, 25 February 2012

Comments

#Comment by Krinkle (talk | contribs)   03:36, 28 February 2012

Confirmed live and updated in http://etherpad.wikimedia.org/IRCBot-Messages ; protect/protect and protect/modify are working again

#Comment by Hashar (talk | contribs)   09:26, 28 February 2012

Well done Timo!! 8-)

Status & tagging log