Use redirect=no in whatLinksHere if the target is a redirect
[lhc/web/wiklou.git] / includes / specials / SpecialWhatlinkshere.php
index 3080fbf..5677ac8 100644 (file)
@@ -208,8 +208,16 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                                        if ( $hidelinks || $hidetrans || $hideredirs || $hideimages ) {
                                                $out->addHTML( $this->getFilterPanel() );
                                        }
-                                       $errMsg = is_int( $namespace ) ? 'nolinkshere-ns' : 'nolinkshere';
-                                       $out->addWikiMsg( $errMsg, $this->target->getPrefixedText() );
+                                       $msgKey = is_int( $namespace ) ? 'nolinkshere-ns-2' : 'nolinkshere-2';
+                                       $link = $this->getLinkRenderer()->makeKnownLink(
+                                               $this->target,
+                                               null,
+                                               [],
+                                               $this->target->isRedirect() ? [ 'redirect' => 'no' ] : []
+                                       );
+
+                                       $errMsg = $this->msg( $msgKey )->rawParams( $link )->parseAsBlock();
+                                       $out->addHTML( $errMsg );
                                        $out->setStatusCode( 404 );
                                }
                        }
@@ -273,7 +281,16 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                        if ( !$this->including() ) {
                                $out->addHTML( $this->whatlinkshereForm() );
                                $out->addHTML( $this->getFilterPanel() );
-                               $out->addWikiMsg( 'linkshere', $this->target->getPrefixedText() );
+
+                               $link = $this->getLinkRenderer()->makeKnownLink(
+                                       $this->target,
+                                       null,
+                                       [],
+                                       $this->target->isRedirect() ? [ 'redirect' => 'no' ] : []
+                               );
+
+                               $msg = $this->msg( 'linkshere-2' )->rawParams( $link )->parseAsBlock();
+                               $out->addHTML( $msg );
 
                                $prevnext = $this->getPrevNext( $prevId, $nextId );
                                $out->addHTML( $prevnext );