Page MenuHomePhabricator

Multiple langlinks to same language cause database conflicts
Closed, DeclinedPublic

Description

If an article has multiple interwiki links to the same language, they are properly displayed in the list of languages, but only one of them is displayed in the API. Steps to reproduce:

  1. Go to http://en.wikipedia.org/wiki/Open_source . If no one changed the article, there should be two interwiki links to Sorani Wikipedia (language code csb): سەرچاوە کراوە and ژێدەرکراوە.
  1. Go to http://en.wikipedia.org/w/api.php?action=query&prop=langlinks&lllimit=500&titles=Open_source . There is only one link to ژێدەرکراوە, the other link is not in the list.

Version: 1.18.x
Severity: normal

Details

Reference
bz24502

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:03 PM
bzimport set Reference to bz24502.
bzimport added a subscriber: Unknown Object (MLST).

The culprit is in the database:

CREATE UNIQUE INDEX /*i*/ll_from ON /*_*/langlinks (ll_from, ll_lang);

This says the combination of (page, language) is unique, but in the case you demonstrated it isn't. Should be changed to:

CREATE UNIQUE INDEX /*i*/ll_from ON /*_*/langlinks (ll_from, ll_lang, ll_title);

and the code updated accordingly (both in the API and in the rest of core).

A related problem is that LinksUpdate class doesn't support more than one link per language too.

Why do you want more than one link per language?

It's not that I particularly want it, it's a MediaWiki feature. As to why the feature is needed, all philosophy aside, for example:

  • One Wikisource text may have more than one translation in another Wikisource, and both translations should have interlanguage links.

Possibly this feature isn't as often used because bots go crazy when they see it.

And I don't think it's as simple as a database update. LinksUpdate::getExistingInterlangs() would have to be reworked to work similarly to LinksUpdate::getExistingInterwikis(), and then everything that depends on it would have to be reworked too...

(In reply to comment #4)

It's not that I particularly want it, it's a MediaWiki feature. As to why the
feature is needed, all philosophy aside, for example:

  • There are heaps of articles for which everyone agrees that they should be

merged, such as
http://en.wikipedia.org/wiki/Category:Articles_to_be_merged_from_May_2008 , and
until merged other wikis should logically have interlanguage links to both
articles.

  • One Wikisource text may have more than one translation in another Wikisource,

and both translations should have interlanguage links.

Having two links labelled "English" doesn't seem like a good way to fix either of those things. What you want is a sublist, like:

  • Français
  • English
    • Rollatini
    • Braciola

It should be good enough to use the names of the articles as the link labels in the sublist, then you don't have to add fields or change the invocation syntax or anything.

This is not a blocker for bug 15607.

I think allowing multiple interlanguage links on one page should be considered a bug. That makes this issue obsolete.

(In reply to comment #6)

I think allowing multiple interlanguage links on one page should be considered
a bug. That makes this issue obsolete.

Should of course be: I think allowing multiple interlanguage links *to the same language* on one page should be considered a bug. That makes this issue obsolete.

It's certainly a bug that LinksUpdate will try to add duplicate links to the langlinks table on every edit, and fail each time due to index conflicts. It should either work nicely or not work at all.

Changing bug meta data accordingly.

I disagree that multiple interlanguage links to the same language on one page should be considered a bug, since there are use cases where that is preferable. But OK, I'll redo the Interlanguage extension without full support for this, and if it is needed somewhere people could continue to use the raw interlanguage links.

(In reply to comment #5)

(In reply to comment #4)

..

  • One Wikisource text may have more than one translation in another Wikisource, and both translations should have interlanguage links.

Having two links labelled "English" doesn't seem like a good way to fix either
of those things. What you want is a sublist, like:

  • Français
  • English
    • Rollatini
    • Braciola

It should be good enough to use the names of the articles as the link labels in
the sublist, then you don't have to add fields or change the invocation syntax
or anything.

This is not a blocker for bug 15607.

English wikisource currently does this using JavaScript.
http://en.wikisource.org/wiki/Template:Interwiki-info
http://en.wikisource.org/wiki/The_Raven_%28Poe%29
see function interwikiExtra() in
http://en.wikisource.org/wiki/MediaWiki:Common.js

Comitted a patch with gerrit 17912 to avoid the database conflict.

Tim commited a patch with gerrit 25232 to avoid having multiple languange links to the same language

gerrit change 25232 merged, with makes this bug LATER.

When a other status is better, please change. Thanks.