https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112561

Revision: 112561
Author:   krinkle
Date:     2012-02-28 01:56:15 +0000 (Tue, 28 Feb 2012)
Log Message:
-----------
[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
    trunk/phase3/tests/phpunit/includes/RecentChangeTest.php

Modified: trunk/phase3/includes/logging/LogFormatter.php
===================================================================
--- trunk/phase3/includes/logging/LogFormatter.php      2012-02-28 01:42:10 UTC 
(rev 112560)
+++ trunk/phase3/includes/logging/LogFormatter.php      2012-02-28 01:56:15 UTC 
(rev 112561)
@@ -226,6 +226,20 @@
                                }
                                break;
 
+                       case 'protect':
+                               switch( $entry->getSubtype() ) {
+                               case 'protect':
+                                       $text = wfMsgExt( 'protectedarticle', 
$msgOpts, $target . ' ' . $parameters[0] );
+                                               break;
+                               case 'unprotect':
+                                       $text = wfMsgExt( 'unprotectedarticle', 
$msgOpts, $target );
+                                               break;
+                               case 'modify':
+                                       $text = wfMsgExt( 
'modifiedarticleprotection', $msgOpts, $target . ' ' . $parameters[0] );
+                                               break;
+                               }
+                               break;
+
                        case 'newusers':
                                switch( $entry->getSubtype() ) {
                                        case 'newusers':

Modified: trunk/phase3/tests/phpunit/includes/RecentChangeTest.php
===================================================================
--- trunk/phase3/tests/phpunit/includes/RecentChangeTest.php    2012-02-28 
01:42:10 UTC (rev 112560)
+++ trunk/phase3/tests/phpunit/includes/RecentChangeTest.php    2012-02-28 
01:56:15 UTC (rev 112561)
@@ -161,12 +161,15 @@
         * @covers LogFormatter::getIRCActionText
         */
        function testIrcMsgForLogTypeProtect() {
+               $protectParams = array(
+                       '[edit=sysop] (indefinite) ‎[move=sysop] (indefinite)'
+               );
 
                # protect/protect
                $this->assertIRCComment(
-                       wfMessage( 'protectedarticle', 'SomeTitle' )->plain() . 
': ' .  $this->user_comment,
+                       wfMessage( 'protectedarticle', 'SomeTitle ' . 
$protectParams[0] )->plain() . ': ' .  $this->user_comment,
                        'protect', 'protect',
-                       array(),
+                       $protectParams,
                        $this->user_comment
                );
 
@@ -180,9 +183,9 @@
 
                # protect/modify
                $this->assertIRCComment(
-                       wfMessage( 'modifiedarticleprotection', 'SomeTitle' 
)->plain() . ': ' .  $this->user_comment,
+                       wfMessage( 'modifiedarticleprotection', 'SomeTitle ' . 
$protectParams[0] )->plain() . ': ' .  $this->user_comment,
                        'protect', 'modify',
-                       array(),
+                       $protectParams,
                        $this->user_comment
                );
        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to