From 15c7079c79ec76f0636413e9fc220f8f3d505f8f Mon Sep 17 00:00:00 2001 From: Liangent Date: Fri, 4 Jan 2013 21:36:17 +0800 Subject: [PATCH] Followup I888c616e: Keep IRC line format unchanged. Change-Id: Ifeec00fc98c7912b6e16b6f07d1fdc26ab4e4fb5 --- includes/WikiPage.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 7620b3adc5..d9cfc9226c 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -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 -- 2.20.1