Move protection log parameters to log_params. Solves bug 12234 and is better for...
authorAaron Schulz <aaron@users.mediawiki.org>
Wed, 10 Sep 2008 19:44:56 +0000 (19:44 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Wed, 10 Sep 2008 19:44:56 +0000 (19:44 +0000)
includes/Article.php
includes/LogEventsList.php

index 4064d7d..6205daa 100644 (file)
@@ -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 );
                                }
index a73e478..075860a 100644 (file)
@@ -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'],