Followup I888c616e: Keep IRC line format unchanged.
authorLiangent <liangent@gmail.com>
Fri, 4 Jan 2013 13:36:17 +0000 (21:36 +0800)
committerLiangent <liangent@gmail.com>
Fri, 4 Jan 2013 13:41:11 +0000 (21:41 +0800)
Change-Id: Ifeec00fc98c7912b6e16b6f07d1fdc26ab4e4fb5

includes/WikiPage.php

index 7620b3a..d9cfc92 100644 (file)
@@ -2274,9 +2274,14 @@ class WikiPage extends Page implements IDBAccessObject {
 
                $encodedExpiry = array();
                $protectDescription = '';
+               # Some bots may parse IRC lines, which are generated from log entries which contain plain
+               # protect description text. Keep them in old format to avoid breaking compatibility.
+               # TODO: Fix protection log to store structured description and format it on-the-fly.
+               $protectDescriptionLog = '';
                foreach ( $limit as $action => $restrictions ) {
                        $encodedExpiry[$action] = $dbw->encodeExpiry( $expiry[$action] );
                        if ( $restrictions != '' ) {
+                               $protectDescriptionLog .= $wgContLang->getDirMark() . "[$action=$restrictions] (";
                                # $action is one of $wgRestrictionTypes = array( 'create', 'edit', 'move', 'upload' ).
                                # All possible message keys are listed here for easier grepping:
                                # * restriction-create
@@ -2307,8 +2312,10 @@ class WikiPage extends Page implements IDBAccessObject {
                                $protectDescription .= wfMessage( 'protect-summary-desc' )
                                        ->params( $actionText, $restrictionsText, $expiryText )
                                        ->inContentLanguage()->text();
+                               $protectDescriptionLog .= $expiryText . ') ';
                        }
                }
+               $protectDescriptionLog = trim( $protectDescriptionLog );
 
                if ( $id ) { # Protection of existing page
                        if ( !wfRunHooks( 'ArticleProtect', array( &$this, &$user, $limit, $reason ) ) ) {
@@ -2413,7 +2420,7 @@ class WikiPage extends Page implements IDBAccessObject {
                if ( $logAction == 'unprotect' ) {
                        $logParams = array();
                } else {
-                       $logParams = array( $protectDescription, $cascade ? 'cascade' : '' );
+                       $logParams = array( $protectDescriptionLog, $cascade ? 'cascade' : '' );
                }
 
                # Update the protection log