From 12dc557a1ef911a65c9d6ba5766bce03c02cadc5 Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Tue, 23 Jan 2007 10:51:33 +0000 Subject: [PATCH] Show expiry time in the null revision inserted on protection with an expiry date. --- includes/Article.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 122558bdd6..93cb029dbe 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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 { -- 2.20.1