Replace Media namespace redirects with File namespace
authorAlex Ezell <aezell@wikimedia.org>
Fri, 5 Oct 2018 21:32:00 +0000 (17:32 -0400)
committerAlex Ezell <aezell@wikimedia.org>
Fri, 5 Oct 2018 22:04:24 +0000 (18:04 -0400)
commit613e269920a7d268b012d61fec24fc4d04b1cd7a
treeebf31e9ddb73dae08b1a90991d4c7f213e6dc819
parent150e3bf46054be0146bb4fcf2cbf3413fb6e627d
Replace Media namespace redirects with File namespace

If a user creates a redirect that goes to a [[Media:example.jpg]]
page, then an exception is thrown because NS_MEDIA is a virtual
namespace. This change catches this case and changes the namespace
to an NS_FILE namespace and the redirect works correctly. This
change only happens when we are dealing with a redirect so other
uses of the NS_MEDIA namespace shouldn't be affected.

Bug: T203942
Change-Id: Ia744059650e16510732a65d51b138b11cbd43eb4
includes/MediaWiki.php
tests/phpunit/includes/MediaWikiTest.php