r97077 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97076‎ | r97077 | r97078 >
Date:17:42, 14 September 2011
Author:aaron
Status:ok
Tags:post1.18deploy 
Comment:
FU r97022: Fallback to empty array for getExtraSortFields() result in __construct() if no value is set for the sort order/type.
Modified paths:
  • /trunk/phase3/includes/Pager.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Pager.php
@@ -119,18 +119,22 @@
120120 $this->mIsBackwards = ( $this->mRequest->getVal( 'dir' ) == 'prev' );
121121 $this->mDb = wfGetDB( DB_SLAVE );
122122
123 - $index = $this->getIndexField();
124 - $extraSort = $this->getExtraSortFields();
 123+ $index = $this->getIndexField(); // column to sort on
 124+ $extraSort = $this->getExtraSortFields(); // extra columns to sort on for query planning
125125 $order = $this->mRequest->getVal( 'order' );
126126 if( is_array( $index ) && isset( $index[$order] ) ) {
127127 $this->mOrderType = $order;
128128 $this->mIndexField = $index[$order];
129 - $this->mExtraSortFields = (array)$extraSort[$order];
 129+ $this->mExtraSortFields = isset( $extraSort[$order] )
 130+ ? (array)$extraSort[$order]
 131+ : array();
130132 } elseif( is_array( $index ) ) {
131133 # First element is the default
132134 reset( $index );
133135 list( $this->mOrderType, $this->mIndexField ) = each( $index );
134 - $this->mExtraSortFields = (array)$extraSort[$this->mOrderType];
 136+ $this->mExtraSortFields = isset( $extraSort[$this->mOrderType] )
 137+ ? (array)$extraSort[$this->mOrderType]
 138+ : array();
135139 } else {
136140 # $index is not an array
137141 $this->mOrderType = null;
@@ -599,8 +603,8 @@
600604 * not be used in the pager offset or in any links for users.
601605 *
602606 * If getIndexField() returns an array of 'querykey' => 'indexfield' pairs then
603 - * this must return a corresponding array of 'querykey' => array( fields...) pairs,
604 - * so that a request with &count=querykey will use array( fields...) to sort.
 607+ * this must return a corresponding array of 'querykey' => array( fields...) pairs
 608+ * in order for a request with &count=querykey to use array( fields...) to sort.
605609 *
606610 * This is useful for pagers that GROUP BY a unique column (say page_id)
607611 * and ORDER BY another (say page_len). Using GROUP BY and ORDER BY both on

Follow-up revisions

RevisionCommit summaryAuthorDate
r97082Merged revisions 97057,97060,97071,97073-97074,97077-97080 via svnmerge from...dantman18:11, 14 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r97022Possible fix for issue reported in r83762. I had a hard time confirming the p...aaron23:24, 13 September 2011

Status & tagging log