This NS_FILE-specific redirect logic was introduced in 2008,
in
3c9536652a3b27ec97cb2e3f046c5e98849c58a4.
mTitle, as referenced to in the comments, no longer exists.
Article also no longer creates redirects in there, that’s now
in WikitextContent::fillParserOutput.
The original commit message describes that this was introduced
to be able to display redirects to foreign file repos. A lot
has changed in how that works since 2008, too :)
Back to the present: for redirects to foreign repos,
`$this->mPage->getFile()->getRedirected()` seems to always return
`null` (a placeholder object is created when the thing doesn’t
exist), so this this foreign repo-specific bit of code is bypassed
anyway. For local redirects, Article::view seems to be working just
fine.
By using Article::view, Categories used on file redirect pages
will now actually be displayed too.
And we can get rid of the otherwise no longer used Article::viewRedirect.
Bug: T29857
Change-Id: Icb02f3af32d10870f58d945cb06a84b3ba1305d3
ParserOptions that would pollute the parser cache. Callers should use
WikiPage::makeParserOptions() to create the ParserOptions object and only
change options that affect the parser cache key.
+* Article::viewRedirect() is deprecated.
== Compatibility ==
MediaWiki 1.30 requires PHP 5.5.9 or later. There is experimental support for
* @param bool $appendSubtitle [optional]
* @param bool $forceKnown Should the image be shown as a bluelink regardless of existence?
* @return string Containing HTML with redirect link
+ *
+ * @deprecated since 1.30
*/
public function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) {
$lang = $this->getTitle()->getPageLanguage();
if ( $this->getTitle()->getNamespace() == NS_FILE && $this->mPage->getFile()->getRedirected() ) {
if ( $this->getTitle()->getDBkey() == $this->mPage->getFile()->getName() || $diff !== null ) {
- // mTitle is the same as the redirect target so ask Article
- // to perform the redirect for us.
$request->setVal( 'diffonly', 'true' );
- parent::view();
- return;
- } else {
- // mTitle is not the same as the redirect target so it is
- // probably the redirect page itself. Fake the redirect symbol
- $out->setPageTitle( $this->getTitle()->getPrefixedText() );
- $out->addHTML( $this->viewRedirect(
- Title::makeTitle( NS_FILE, $this->mPage->getFile()->getName() ),
- /* $appendSubtitle */ true,
- /* $forceKnown */ true )
- );
- $this->mPage->doViewUpdates( $this->getContext()->getUser(), $this->getOldID() );
- return;
}
+
+ parent::view();
+ return;
}
if ( $wgShowEXIF && $this->displayImg->exists() ) {