https://bugzilla.wikimedia.org/show_bug.cgi?id=6181

Joshua Scott <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joshua.scott@alliedtelesis.
                   |                            |co.nz

--- Comment #12 from Joshua Scott <[email protected]> ---
Here is a patch to fix the issue seen by GregH, using his suggested fix.

Note: If {{subst:REVISIONID}} is used on a newly created page, the string
"Initial Revision" will be used in place of a revision number.




diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index 10765de..a8c6dd7 100755
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -2761,7 +2761,9 @@ class Parser {
                                # *after* a revision ID has been assigned.
                                $this->mOutput->setFlag( 'vary-revision' );
                                wfDebug( __METHOD__ . ": {{REVISIONID}} used,
setting vary-revision...\n" );
-                               $value = $this->mRevisionId;
+                                $value = $this->mRevisionId;
+                                if ($value == "")
+                                        $value = $this->tryGetRevisionId();
                                break;
                        case 'revisionday':
                                # Let the edit saving system know we should
parse the page
@@ -5517,6 +5519,17 @@ class Parser {
                return $this->mRevisionTimestamp;
        }

+        /**
+         * This code is to enable {{subst:REVISIONID}}. It will use the
+         * previous revision ID if it is available. If this is a new
+         * page being saved for the first time, the string "Initial
+         * Revision" will be used instead.
+        */
+        function tryGetRevisionId() {
+            $rev = Revision::newFromTitle ($this->mTitle);
+            return $rev ? $rev->getId() : "Initial Revision";
+       }
+
        /**
         * Get the name of the user that edited the last revision
         *

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to