Page MenuHomePhabricator

Remove support for $wgMaxRedirect
Open, Needs TriagePublic


$wgMaxRedirect has never worked as intended (T32359), was never used by WMF (T67064), and cannot function properly with the current database schema. Since this feature is unused and of dubious value, it should be removed. Removing it will simplify ongoing refactoring work on the Content and WikiPage classes.

Problems with this feature as presently implemented:

  • Consider a redirect chain A -> B -> C
  • With $wgMaxRedirect = 2, the redirect table would record the "ultimate" targets, A -> C and B -> C.
  • When B is edited and now links to X, the redirect entry for A needs to be updated to be A -> X.
  • However, since there is no link A -> B recorded in the database, MediaWiki can't know that it needs to do anything about the redirect entry for A.

Other reasons why this feature cannot work as currently implemented:

  • Consider a redirect chain A -> B -> C
  • With $wgMaxRedirect = 2, a user accessing A will be shown page C, with the message "redirected from A".
  • If the user wants to change the redirect and goes to edit A, they find a redirect to B, not to C! They would have to known that they need to go to B to change the redirect.
  • It would be nice to show something like "redirected from A via B". But in order to do this, the link from A to B would have to be present in the database.

Consideration about changing the storage approach:

  • at the very least, only direct redirects should be recorded in the redirect table.
  • "deep" redirects could still be followed by following the individual steps in the redirect table, though that would be somewhat inefficient.
  • "deep" redirects could be recorded in a separate table, with the appropriate update logic in place to ensure consistency, if the cost for developing this is justified

In the light for the above, it seems best to simply remove support for now.