Page MenuHomePhabricator

MessageContent varies by userlang but its content gets in parser cache without that option set
Closed, ResolvedPublic

Description

Current behaviour and how to replicate:

Open a file description page where revision #0 is missing

(The revision #0 of the page named "Luftaufnahmen Nordseekueste 2012 05 D50 by-RaBoe 066.jpg" does not exist.

This is usually caused by following an outdated history link to a page that has been deleted. Details can be found in the deletion log.)

  1. Switch your user language to e.g. "de" (either with uselang=de or in the prefs)
  2. Open the file description page again - you get the message again in English.
  3. Purge the server cache of that file (action=purge).
  4. Now, the message is rendered in German (de).
  5. Switch your user language back to English. The message will be still shown in German despite reloading the page.

Expected behaviour:

Error message in user language. No cache pollution.

Test case:
https://commons.wikimedia.org/w/index.php?title=File:Luftaufnahmen_Nordseekueste_2012_05_D50_by-RaBoe_066.jpg&uselang=de


Version: 1.21.x
Severity: normal

Details

Reference
bz41065

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:51 AM
bzimport set Reference to bz41065.
bzimport added a subscriber: Unknown Object (MLST).

Ok, so what happens.

As a fallback, if the revision cannot be found, a MessageContent object is returned with the message missing-revision. This then gets stored in parser cache. The messageContent varries by user language, but its cached as if it does not.

The quick fix would be in Article::fetchContentObject to instead of doing:
$this->mContentObject = new MessageContent( 'missing-revision', array( $oldid ), array() )
Do:
$this->mContentObject = new MessageContent( wfMessage( 'missing-revision' )->inContentLanguage(), array( $oldid ), array() )

[as an aside, what is that third, empty array, parameter for?]

However, a more proper fix would be for MessageContent to signal that its content varies by userlanguage to the ParserCache. That's getting a little bit further into the ContentHandler stuff then I'm currently familiar with.

Created attachment 14082
Screenshot showing the issue. Uploader of the photo this is a derivative of is https://commons.wikimedia.org/wiki/User:Red_Castle - License: unknown

Attached:

commons_revision_missing_not_in_user_language.png (1×1 px, 280 KB)

[[Commons:File:Délégation générale du Québec à Londres 2013.JPG]] says "(missing-revision: 0)" for me too, but [[Commons:File:Ghost creepy 2013-12-12 17-52.jpg]] has text in Spanish (with uselang=sv):

"La revisión n.º 0 de la página llamada «Ghost creepy 2013-12-12 17-52.jpg» no existe.

Normalmente esto ocurre cuando se sigue un enlace de historial obsoleto que apunta a una página ya borrada. Puedes encontrar detalles en el registro de borrados."

Change 101479 had a related patch set uploaded by Brian Wolff:
Mark ParserOutput of MessageContent as varying by userlanguage

https://gerrit.wikimedia.org/r/101479

Change 101479 merged by jenkins-bot:
Mark ParserOutput of MessageContent as varying by userlanguage

https://gerrit.wikimedia.org/r/101479

All patches mentioned in this report were merged or abandoned - is there more work left to do here (if yes: please reset the bug report status to NEW or ASSIGNED), or can you close this ticket as RESOLVED FIXED?

Rillke claimed this task.

No new reports, so assume it's fixed.

Rillke set Security to None.