From 3ba2d84bd1a1f6a4ae1354943322a1545b8abe02 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 6 Jan 2008 03:17:09 +0000 Subject: [PATCH] Revision timestamp comes out as the current time when no rev ID is given (like the first time prepareTextForEdit() is called). This works for new revisions, but is wrong for null edits. Needs to be flagged so that editUpdates() knows to parse after rev ID given so that it can get the last timestamp. --- includes/Parser.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/includes/Parser.php b/includes/Parser.php index a14cace280..6c0dc39984 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -2435,14 +2435,34 @@ class Parser wfDebug( __METHOD__ . ": {{REVISIONID}} used, setting vary-revision...\n" ); return $this->mRevisionId; case 'revisionday': + // Let the edit saving system know we should parse the page + // *after* a revision ID has been assigned. This is for null edits. + $this->mOutput->setFlag( 'vary-revision' ); + wfDebug( __METHOD__ . ": {{REVISIONDAY}} used, setting vary-revision...\n" ); return intval( substr( $this->getRevisionTimestamp(), 6, 2 ) ); case 'revisionday2': + // Let the edit saving system know we should parse the page + // *after* a revision ID has been assigned. This is for null edits. + $this->mOutput->setFlag( 'vary-revision' ); + wfDebug( __METHOD__ . ": {{REVISIONDAY2}} used, setting vary-revision...\n" ); return substr( $this->getRevisionTimestamp(), 6, 2 ); case 'revisionmonth': + // Let the edit saving system know we should parse the page + // *after* a revision ID has been assigned. This is for null edits. + $this->mOutput->setFlag( 'vary-revision' ); + wfDebug( __METHOD__ . ": {{REVISIONMONTH}} used, setting vary-revision...\n" ); return intval( substr( $this->getRevisionTimestamp(), 4, 2 ) ); case 'revisionyear': + // Let the edit saving system know we should parse the page + // *after* a revision ID has been assigned. This is for null edits. + $this->mOutput->setFlag( 'vary-revision' ); + wfDebug( __METHOD__ . ": {{REVISIONYEAR}} used, setting vary-revision...\n" ); return substr( $this->getRevisionTimestamp(), 0, 4 ); case 'revisiontimestamp': + // Let the edit saving system know we should parse the page + // *after* a revision ID has been assigned. This is for null edits. + $this->mOutput->setFlag( 'vary-revision' ); + wfDebug( __METHOD__ . ": {{REVISIONTIMESTAMP}} used, setting vary-revision...\n" ); return $this->getRevisionTimestamp(); case 'namespace': return str_replace('_',' ',$wgContLang->getNsText( $this->mTitle->getNamespace() ) ); -- 2.20.1