Merge "Remove $wgDisableUserGroupExpiry feature flag"
[lhc/web/wiklou.git] / includes / specials / SpecialWhatlinkshere.php
index b1c3f16..6f91c46 100644 (file)
@@ -21,6 +21,8 @@
  * @todo Use some variant of Pager or something; the pagination here is lousy.
  */
 
+use Wikimedia\Rdbms\IDatabase;
+
 /**
  * Implements Special:Whatlinkshere
  *
@@ -105,7 +107,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
         */
        function showIndirectLinks( $level, $target, $limit, $from = 0, $back = 0 ) {
                $out = $this->getOutput();
-               $dbr = wfGetDB( DB_SLAVE );
+               $dbr = wfGetDB( DB_REPLICA );
 
                $hidelinks = $this->opts->getValue( 'hidelinks' );
                $hideredirs = $this->opts->getValue( 'hideredirs' );
@@ -160,7 +162,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                        ];
                        $on['rd_namespace'] = $target->getNamespace();
                        // Inner LIMIT is 2X in case of stale backlinks with wrong namespaces
-                       $subQuery = $dbr->selectSqlText(
+                       $subQuery = $dbr->selectSQLText(
                                [ $table, 'redirect', 'page' ],
                                [ $fromCol, 'rd_from' ],
                                $conds[$table],
@@ -327,7 +329,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                        $query = [];
                }
 
-               $link = Linker::linkKnown(
+               $link = $this->getLinkRenderer()->makeKnownLink(
                        $nt,
                        null,
                        $row->page_is_redirect ? [ 'class' => 'mw-redirect' ] : [],
@@ -376,9 +378,15 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                        $title = $this->getPageTitle();
                }
 
+               $linkRenderer = $this->getLinkRenderer();
+
+               if ( $text !== null ) {
+                       $text = new HtmlArmor( $text );
+               }
+
                // always show a "<- Links" link
                $links = [
-                       'links' => Linker::linkKnown(
+                       'links' => $linkRenderer->makeKnownLink(
                                $title,
                                $text,
                                [],
@@ -393,7 +401,11 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                        // check, if the content model is editable through action=edit
                        ContentHandler::getForTitle( $target )->supportsDirectEditing()
                ) {
-                       $links['edit'] = Linker::linkKnown(
+                       if ( $editText !== null ) {
+                               $editText = new HtmlArmor( $editText );
+                       }
+
+                       $links['edit'] = $linkRenderer->makeKnownLink(
                                $target,
                                $editText,
                                [],
@@ -406,7 +418,11 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
        }
 
        function makeSelfLink( $text, $query ) {
-               return Linker::linkKnown(
+               if ( $text !== null ) {
+                       $text = new HtmlArmor( $text );
+               }
+
+               return $this->getLinkRenderer()->makeKnownLink(
                        $this->selfTitle,
                        $text,
                        [],