(bug 40353) SpecialDoubleRedirect: Fix for interwiki redirects
Previously there were problems:
- Non-double redirects that point to interwiki of the same name
were also included (because it ignored rd_interwiki, it looked
up a local page by that name and found a redirect, again etc.)
e.g.:
"Foo (edit) → Foo → somewiki:Foo"
- Double redirects that end in an interwiki appeared to be
linking to a local one
"X (edit) → Y → Y" // the second Y is really somewiki:Y
- Double redirects where the end is an interwiki and of a
different title, are not included in the results.
- Redundant third join to page (pc), the information needed from
that table (title, namespace) are already available in the
redirect table. Redundant joins are generally not a bug, but
in this case the third join caused interwiki targets to be
excluded in most cases since those external pages did not
exist in the local table (except for coincidences).
Example wiki:
* Foo redirects to somewiki:Foo
* X redirects to Y
* Y redirects to somewiki:Y
* A redirects to B
* B redirects to somewiki:C
Before (http://sqlfiddle.com/#!2/1d656/9/0):
* Foo → Foo → Foo
* X → Y → Y
After (http://sqlfiddle.com/#!2/1d656/6/0):
* X → Y → somewiki:Y
* A → B → somewiki:C
Change-Id: I986f3a03d71dd6457842e6189653bd606f4fa97e