From: Aaron Schulz Date: Wed, 1 Jun 2016 20:59:35 +0000 (-0700) Subject: Fix Special:PrefixIndex paging links X-Git-Tag: 1.31.0-rc.0~6731^2 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=6c0b27bb2e8c80f3c99a5509d94dad878520af1b;p=lhc%2Fweb%2Fwiklou.git Fix Special:PrefixIndex paging links Capture the last row instead of skipping it and then not finding anything in the fetchObject() call. Bug: T136738 Change-Id: Ibcfa6c18c54227fda75298a849717e6ef3418928 --- diff --git a/includes/specials/SpecialPrefixindex.php b/includes/specials/SpecialPrefixindex.php index 6db4f2cbfc..87a5b27be0 100644 --- a/includes/specials/SpecialPrefixindex.php +++ b/includes/specials/SpecialPrefixindex.php @@ -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(); @@ -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 ); @@ -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, @@ -275,7 +277,7 @@ class SpecialPrefixindex extends SpecialAllPages { $nextLink = Linker::linkKnown( $this->getPageTitle(), - $this->msg( 'nextpage', str_replace( '_', ' ', $s->page_title ) )->escaped(), + $this->msg( 'nextpage', str_replace( '_', ' ', $nextRow->page_title ) )->escaped(), [], $query );