WikiPage: Fix viewing of wiki redirects to NS_MEDIA
authorAlex Ezell <aezell@wikimedia.org>
Tue, 9 Oct 2018 15:51:04 +0000 (11:51 -0400)
committerKrinkle <krinklemail@gmail.com>
Thu, 11 Oct 2018 01:29:47 +0000 (01:29 +0000)
commitd4a45f9ea8b9e68893f1742a2ff4db19e3725acd
tree2123d24cab1f05dfe8a4bbf9c0d1ff82850220fd
parent2f187ce749718073b17e12f4e90e7b5ac8b2061a
WikiPage: Fix viewing of wiki redirects to NS_MEDIA

If a user creates a redirect to a Media namespace title, a fatal
error is thrown on viewing such rediect because we protect against
redirecting to virtual namespaces. This fix catches this kind of
redirect and modifies the namespace to be File before the Title object
is created.

Follow-up from 613e2699.

Bug: T203942
Change-Id: Ib211d98498f635862fea6bf3e7395f4f8718b3d8
includes/page/WikiPage.php
tests/phpunit/includes/page/WikiPageDbTestBase.php