{{subst:REVISIONID}} doesn't work
Closed, ResolvedPublic

Description

Author: kalan.001

Description:
Test it on the page above — if you save it, no matter whether you've actually edited something or not, you will receive an empty space instead of {{REVISIONID}}; the only way to recover it is to do a purge.

This might be confusing for some places where {{REVISIONID}} is actually used, especially in combination with parser functions that distinguish preview and saved page this way.


Version: 1.12.x
Severity: normal
URL: http://en.wikipedia.org/wiki/User:Kalan/12694

bzimport added a project: MediaWiki-Parser.Via ConduitNov 21 2014, 10:05 PM
bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz12694.
bzimport created this task.Via LegacyJan 19 2008, 7:13 PM
MER-C added a comment.Via ConduitFeb 18 2008, 7:15 AM

Works for me. However, using {{subst:REVISIONID}} does result in permanent empty space, see [[WP:VPT#Using subst with REVISIONID]].

Catrope added a comment.Via ConduitFeb 18 2008, 2:30 PM

(In reply to comment #1)

Works for me. However, using {{subst:REVISIONID}} does result in permanent
empty space, see [[WP:VPT#Using subst with REVISIONID]].

{{subst:REVISIONID}} is very tough because of the way we create revisions:

  1. An entry in the text table containing the revision's text is created
  2. The ID of the newly created entry is obtained
  3. An entry in the revision table is created, referencing the text table entry by the ID obtained in #2
  4. The revision ID of the newly created revision is obtained
  5. The page_latest field of the page's entry in the page table is set to the new revision ID

It's easy to see that the text has to be known before the revision is created, so the new revision ID isn't known at that time. A possible solution would be to go back and replace any occurrences of {{subst:REVISIONID}} in the text entry after creating the revision, but that would be hacky and possibly expensive.

bzimport added a comment.Via ConduitFeb 18 2008, 2:38 PM

kalan.001 wrote:

It's easy to see that the text has to be known before the revision is created

Not really. I can't remember whether this has been proposed anywhere, but anyway it's pretty possible to substitute the top revid of the page before saving.

Then, you will be able to make "prooflinks" such as {{fullurl:{{FULLPAGENAME}}|diff=next&oldid={{subst:REVISIONID}}}} (that's possibly the main purpose of this substitution).

Catrope added a comment.Via ConduitFeb 18 2008, 2:42 PM

(In reply to comment #3)

> It's easy to see that the text has to be known before the revision is created

Not really. I can't remember whether this has been proposed anywhere, but
anyway it's pretty possible to substitute the top revid of the page before
saving.

That would give you the revid of the revision just before yours (the 'previous' revision, if you like). Assigning this behavior to {{subst:REVISIONID}} would create a discrepancy with {{REVISIONID}}. Of course {{PREVREVID}} or something similar could be implemented.

leucosticte added a comment.Via ConduitFeb 19 2008, 1:57 AM

Perhaps there could be a workaround? What if there were a magic word for the next REVISIONID in a page history after the last REVISIONID? I.e., as I'm editing (or as I'm saving, whichever the case may be), I know that the previous REVISIONID for that page was 314159265. So, I save it with this new magic word, and it knows that on a permanent basis, it is supposed to display the next REVISIONID in the page history after 314159265. A potential issue with this, I guess, is that what if someone saves another version with a different REVISIONID while you're editing? Would that be a problem? (Cross-posted to WP:VPT)

bzimport added a comment.Via ConduitOct 3 2008, 5:32 PM

happy_melon wrote:

(In reply to comment #2)

... A possible solution would be
to go back and replace any occurrences of {{subst:REVISIONID}} in the text
entry after creating the revision, but that would be hacky and possibly
expensive.

Not that expensive, surely? Naturally you'd do a check for that string *before* you saved it, and only do the extra db transaction to substitute it if it was actually there. What percentage of page saves do you think include that magic word? :-D And I guess it is a little bit hacky, but not offensively so.

(In reply to comment #5)

Perhaps there could be a workaround? What if there were a magic word for the
next REVISIONID in a page history after the last REVISIONID? I.e., as I'm
editing (or as I'm saving, whichever the case may be), I know that the previous
REVISIONID for that page was 314159265. So, I save it with this new magic word,
and it knows that on a permanent basis, it is supposed to display the next
REVISIONID in the page history after 314159265. A potential issue with this, I
guess, is that what if someone saves another version with a different
REVISIONID while you're editing? Would that be a problem?

Eh? What use would that be? {{NEXTREVISIONID}} would be constantly undefined (by definition, unless we totally change the way we assign ids), and {{subst:NEXTREVISIONID}} is a different way of restating the same problem, while entrenching the mentality of "revision id is defined only after page saves", which is unavoidable from the db structure but still unhelpful.

bzimport added a comment.Via ConduitOct 3 2008, 5:39 PM

mike.lifeguard+bugs wrote:

I think this summary is describes more accurately the real problem.

bzimport added a comment.Via ConduitFeb 23 2009, 9:03 AM

anon.hui wrote:

*** This bug has been marked as a duplicate of bug 6181 ***

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.