Page MenuHomePhabricator

Redirects - Try to detect and auto fix double redirects before they happen
Closed, DeclinedPublic

Description

As far as I can tell double redirects are not a good thing in wikidata (after a discussion with daniel)

I.e. if A redirects to B which redirects to C then A will break / not recirect through the whole chain.

When redirects are created there should be some form of check / automated action fixing double redirects that would be created.

  • If I try to create a redirect to an item that is already a redirect, point to the target at the end of the chain instead.
  • If I turn an item into a redirect that has another redirect pointing toward it already, change that redirect to point to the new target

Version: unspecified
Severity: normal
Whiteboard: u=dev c=backend p=0

Details

Reference
bz69167

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:38 AM
bzimport set Reference to bz69167.
bzimport added a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Lydia_Pintscher raised the priority of this task from Low to Normal.Dec 27 2014, 2:59 PM
Lydia_Pintscher set Security to None.
Lydia_Pintscher added a project: patch-welcome.
Lydia_Pintscher removed a subscriber: Wikidata-bugs.
Stryn added a subscriber: Stryn.Dec 28 2014, 11:22 AM

Historically bots and humans fix double redirects in MediaWiki, not the software. For the bot part we have https://phabricator.wikimedia.org/T77025

The issue with double redirects is slightly different within wikibase.

When using wbgetentities (or probably any api module) with the ID of a redirect everything is fine, you edit the target of the redirect.

If you do this for the ID at the beginning of the chain of a double redirect then instead the entity shows as missing.

Either the software should automatically avoid double redirects when creating them
OR
The software should be able to navigate through multiple levels of redirect

Well AFAIK the software now doesn't allow for redirecting to a redirect, a RedirectCreationException is thrown with the code target-is-redirect

Personally I think the maxResolutionDepth of EntityRedirectResolvingDecorator should be set to something greater than 1, perhaps 5?
This will avoid the issue described above and shouldn't impact anything greatly.
Bots would continue to run to fix redirects

The alternative would be on creating a redirect, find everything that is already redirecting to the itemid that you are about to redirect to somewhere else and also change those....

Thoughts @daniel

I don't think auto fix double redirects is a good idea.

For example, there're 1000 items redirected to item A and 1000 items redirected to item B. If we merge item A and item B, we must at least fix 1000 pages.

Also redirects are automatically fixed by bots.

It's however useful to increase $wgMaxRedirects in case double redirects break other services (wbgetentities, usage tracking, RDF dump, ...)

daniel added a comment.Jul 9 2015, 9:07 AM

Personally I think the maxResolutionDepth of EntityRedirectResolvingDecorator should be set to something greater than 1, perhaps 5?
This will avoid the issue described above and shouldn't impact anything greatly.

It should be $wgMaxRedirects, which is 1 per default and on all WMF sites, afaik. Would be interesting to know if there would be any issues with increasing it. However, I see no reason to treat wikibase items specially here. Item redirects should behave e3xactly as all redirects do (and this is currently the case, as far as I can tell).

The alternative would be on creating a redirect, find everything that is already redirecting to the itemid that you are about to redirect to somewhere else and also change those....

That's what $wgFixDoubleRedirects controls. It's disabled on WMF sites I think. The documentation says: "Fix double redirects after a page move. Tends to conflict with page move vandalism, use only on a private wiki."

It would be nice if RedirectCreationInteractor would optionally fix double redirects, if $wgFixDoubleRedirects is set. That way, Special:MergeItems would behave in a way that is consistent with what Special:MovePage does.

It would be nice if RedirectCreationInteractor would optionally fix double redirects, if $wgFixDoubleRedirects is set. That way, Special:MergeItems would behave in a way that is consistent with what Special:MovePage does.

That sounds like a plan

Lydia_Pintscher closed this task as Declined.Apr 23 2017, 5:07 PM

Declining based on comments.

Restricted Application removed a subscriber: Liuxinyu970226. · View Herald TranscriptApr 23 2017, 5:07 PM