Fixed {{REVISION(TIMESTAMP|USER|SIZE)}} on new revisions
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 31 Mar 2015 04:00:13 +0000 (21:00 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 31 Mar 2015 04:10:09 +0000 (21:10 -0700)
* 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

index 2f443c0..40b0a4f 100644 (file)
@@ -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();