Show expiry time in the null revision inserted on protection with an expiry date.
authorAndrew Garrett <werdna@users.mediawiki.org>
Tue, 23 Jan 2007 10:51:33 +0000 (10:51 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Tue, 23 Jan 2007 10:51:33 +0000 (10:51 +0000)
includes/Article.php

index 122558b..93cb029 100644 (file)
@@ -1686,19 +1686,29 @@ class Article {
 
                                $dbw = wfGetDB( DB_MASTER );
 
+                               $encodedExpiry = Block::encodeExpiry($expiry, $dbw );
+
+                               $expiry_description = '';
+
+                               if ( $encodedExpiry != 'infinity' ) {
+                                       $expiry_description = ' (' . wfMsgForContent( 'protect-expiring', $wgContLang->timeanddate( $expiry ) ).')';
+                               }
+
                                # Prepare a null revision to be added to the history
                                $comment = $wgContLang->ucfirst( wfMsgForContent( $protect ? 'protectedarticle' : 'unprotectedarticle', $this->mTitle->getPrefixedText() ) );
+
                                if( $reason )
                                        $comment .= ": $reason";
                                if( $protect )
                                        $comment .= " [$updated]";
+                               if ( $expiry_description && $protect )
+                                       $comment .= "$expiry_description";
+
                                $nullRevision = Revision::newNullRevision( $dbw, $id, $comment, true );
                                $nullRevId = $nullRevision->insertOn( $dbw );
 
                                # Update restrictions table
                                foreach( $limit as $action => $restrictions ) {
-                                       $encodedExpiry = Block::encodeExpiry($expiry, $dbw );
-
                                        if ($restrictions != '' ) {
                                                $dbw->replace( 'page_restrictions', array( 'pr_pagetype'),
                                                        array( 'pr_page' => $id, 'pr_type' => $action
@@ -1726,16 +1736,11 @@ class Article {
                                $log = new LogPage( 'protect' );
 
                                $cascade_description = '';
-                               $expiry_description = '';
 
                                if ($cascade) {
                                        $cascade_description = ' ['.wfMsg('protect-summary-cascade').']';
                                }
 
-                               if ( $encodedExpiry != 'infinity' ) {
-                                       $expiry_description = ' (' . wfMsgForContent( 'protect-expiring', $wgContLang->timeanddate( $expiry ) ).')';
-                               }
-
                                if( $protect ) {
                                        $log->addEntry( 'protect', $this->mTitle, trim( $reason . " [$updated]$cascade_description$expiry_description" ) );
                                } else {