From ac0de3c4307877c2c45a96b783cf512d8b9bde06 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 30 Mar 2015 21:00:13 -0700 Subject: [PATCH] Fixed {{REVISION(TIMESTAMP|USER|SIZE)}} on new revisions * This makes use of the injected new revision object used elsewhere in Parser to solve this problem. Bug: T94407 Change-Id: I7881583cf7cb2bc799c89ffaa2a344a2d4ca3a4e --- includes/parser/Parser.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 2f443c0164..40b0a4f459 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -5983,7 +5983,19 @@ class Parser { return null; } - $this->mRevisionObject = Revision::newFromId( $this->mRevisionId ); + $rev = call_user_func( + $this->mOptions->getCurrentRevisionCallback(), $this->getTitle(), $this + ); + + # If the parse is for a new revision, then the callback should have + # already been set to force the object and should match mRevisionId. + # If not, try to fetch by mRevisionId for sanity. + if ( $rev && $rev->getId() != $this->mRevisionId ) { + $rev = Revision::newFromId( $this->mRevisionId ); + } + + $this->mRevisionObject = $rev; + return $this->mRevisionObject; } @@ -5994,7 +6006,6 @@ class Parser { */ public function getRevisionTimestamp() { if ( is_null( $this->mRevisionTimestamp ) ) { - global $wgContLang; $revObject = $this->getRevisionObject(); -- 2.20.1