Merge "Add parameter to API modules to apply change tags to log entries"
[lhc/web/wiklou.git] / includes / specials / SpecialPrefixindex.php
index 6db4f2c..4671591 100644 (file)
@@ -166,6 +166,8 @@ class SpecialPrefixindex extends SpecialAllPages {
                $prefixList = $this->getNamespaceKeyAndText( $namespace, $prefix );
                $namespaces = $wgContLang->getNamespaces();
                $res = null;
+               $n = 0;
+               $nextRow = null;
 
                if ( !$prefixList || !$fromList ) {
                        $out = $this->msg( 'allpagesbadtitle' )->parseAsBlock();
@@ -179,7 +181,7 @@ class SpecialPrefixindex extends SpecialAllPages {
 
                        # ## @todo FIXME: Should complain if $fromNs != $namespace
 
-                       $dbr = wfGetDB( DB_SLAVE );
+                       $dbr = wfGetDB( DB_REPLICA );
 
                        $conds = [
                                'page_namespace' => $namespace,
@@ -207,7 +209,6 @@ class SpecialPrefixindex extends SpecialAllPages {
 
                        // @todo FIXME: Side link to previous
 
-                       $n = 0;
                        if ( $res->numRows() > 0 ) {
                                $out = Html::openElement( 'ul', [ 'class' => 'mw-prefixindex-list' ] );
                                $linkCache = MediaWikiServices::getInstance()->getLinkCache();
@@ -215,6 +216,7 @@ class SpecialPrefixindex extends SpecialAllPages {
                                $prefixLength = strlen( $prefix );
                                foreach ( $res as $row ) {
                                        if ( $n >= $this->maxPerPage ) {
+                                               $nextRow = $row;
                                                break;
                                        }
                                        $title = Title::newFromRow( $row );
@@ -226,9 +228,9 @@ class SpecialPrefixindex extends SpecialAllPages {
                                                $displayed = substr( $displayed, $prefixLength );
                                        }
                                        $link = ( $title->isRedirect() ? '<div class="allpagesredirect">' : '' ) .
-                                               Linker::linkKnown(
+                                               $this->getLinkRenderer()->makeKnownLink(
                                                        $title,
-                                                       htmlspecialchars( $displayed )
+                                                       $displayed
                                                ) .
                                                ( $title->isRedirect() ? '</div>' : '' );
 
@@ -259,9 +261,9 @@ class SpecialPrefixindex extends SpecialAllPages {
 
                $topOut = $this->namespacePrefixForm( $namespace, $prefix );
 
-               if ( $res && ( $n == $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
+               if ( $res && ( $n == $this->maxPerPage ) && $nextRow ) {
                        $query = [
-                               'from' => $s->page_title,
+                               'from' => $nextRow->page_title,
                                'prefix' => $prefix,
                                'hideredirects' => $this->hideRedirects,
                                'stripprefix' => $this->stripPrefix,
@@ -273,9 +275,9 @@ class SpecialPrefixindex extends SpecialAllPages {
                                $query['namespace'] = $namespace;
                        }
 
-                       $nextLink = Linker::linkKnown(
+                       $nextLink = $this->getLinkRenderer()->makeKnownLink(
                                $this->getPageTitle(),
-                               $this->msg( 'nextpage', str_replace( '_', ' ', $s->page_title ) )->escaped(),
+                               $this->msg( 'nextpage', str_replace( '_', ' ', $nextRow->page_title ) )->text(),
                                [],
                                $query
                        );