From be13f1d353ee43220f1347575dea1cf5553f64b8 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 10 Sep 2008 19:44:56 +0000 Subject: [PATCH] Move protection log parameters to log_params. Solves bug 12234 and is better for i18n. --- includes/Article.php | 22 +++------------------- includes/LogEventsList.php | 13 ++++++++++++- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 4064d7df6e..6205daa4ef 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1795,7 +1795,7 @@ class Article { return false; } - if (!$cascade) { + if( !$cascade ) { $cascade = false; } @@ -1824,11 +1824,6 @@ class Article { $encodedExpiry = Block::encodeExpiry($expiry, $dbw ); - $expiry_description = ''; - if ( $encodedExpiry != 'infinity' ) { - $expiry_description = ' (' . wfMsgForContent( 'protect-expiring', $wgContLang->timeanddate( $expiry, false, false ) ).')'; - } - # Prepare a null revision to be added to the history $modified = $current != '' && $protect; if ( $protect ) { @@ -1848,19 +1843,8 @@ class Article { } } - $cascade_description = ''; - if ($cascade) { - $cascade_description = ' ['.wfMsg('protect-summary-cascade').']'; - } - if( $reason ) $comment .= ": $reason"; - if( $protect ) - $comment .= " [$updated]"; - if ( $expiry_description && $protect ) - $comment .= "$expiry_description"; - if ( $cascade ) - $comment .= "$cascade_description"; # Update restrictions table foreach( $limit as $action => $restrictions ) { @@ -1897,8 +1881,8 @@ class Article { # Update the protection log $log = new LogPage( 'protect' ); if( $protect ) { - $log->addEntry( $modified ? 'modify' : 'protect', $this->mTitle, - trim( $reason . " [$updated]$cascade_description$expiry_description" ) ); + $params = array($updated,$encodedExpiry,$cascade ? 'cascade' : ''); + $log->addEntry( $modified ? 'modify' : 'protect', $this->mTitle, trim( $reason), $params ); } else { $log->addEntry( 'unprotect', $this->mTitle, $reason ); } diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index a73e4781f3..075860aa58 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -239,7 +239,18 @@ class LogEventsList { 'action=unblock&ip=' . urlencode( $row->log_title ) ) . ')'; // Show change protection link } else if( self::typeAction($row,'protect',array('modify','protect','unprotect')) ) { - $revert = '(' . $this->skin->makeKnownLinkObj( $title, $this->message['hist'], + if( $row->log_type == 'protect' && count($paramArray) == 3 ) { + $revert .= " [{$paramArray[0]}]"; // the restrictions + if( $paramArray[1] != 'infinity' ) { + $revert .= ' (' . wfMsgForContent( 'protect-expiring', + $wgContLang->timeanddate( $paramArray[1], false, false ) ).')'; + } + if( $paramArray[2] ) { + $revert .= ' ['.wfMsg('protect-summary-cascade').']'; + } + } + $revert = $revert ? "$revert " : ""; + $revert .= '(' . $this->skin->makeKnownLinkObj( $title, $this->message['hist'], 'action=history&offset=' . urlencode($row->log_timestamp) ) . ')'; if( $wgUser->isAllowed('protect') && $row->log_action != 'unprotect' ) { $revert .= ' (' . $this->skin->makeKnownLinkObj( $title, $this->message['protect_change'], -- 2.20.1