r106220 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106219‎ | r106220 | r106221 >
Date:18:34, 14 December 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php
@@ -158,18 +158,25 @@
159159 $query->sortkeys = array();
160160
161161 foreach ( $params['sort'] as $sort ) {
162 - $propertyValue = SMWPropertyValue::makeUserProperty( trim( $sort ) );
163 - if ( $propertyValue->isValid() ) {
164 - $sortkey = $propertyValue->getDataItem()->getKey();
165 - $order = current( $orders );
166 - if ( $order === false ) { // default
167 - $order = 'ASC';
168 - }
169 - $query->sortkeys[$sortkey] = $order; // should we check for duplicate sort keys?
 162+ if ( trim( $sort ) === '' ) {
 163+ $query->sortkeys[''] = current( $orders );
170164 next( $orders );
171 - } else {
172 - $query->addErrors( $propertyValue->getErrors() );
173165 }
 166+ else {
 167+ $propertyValue = SMWPropertyValue::makeUserProperty( trim( $sort ) );
 168+
 169+ if ( $propertyValue->isValid() ) {
 170+ $sortkey = $propertyValue->getDataItem()->getKey();
 171+ $order = current( $orders );
 172+ if ( $order === false ) { // default
 173+ $order = 'ASC';
 174+ }
 175+ $query->sortkeys[$sortkey] = $order; // should we check for duplicate sort keys?
 176+ next( $orders );
 177+ } else {
 178+ $query->addErrors( $propertyValue->getErrors() );
 179+ }
 180+ }
174181 }
175182
176183 if ( current( $orders ) !== false ) { // sort key remaining, apply to page name

Follow-up revisions

RevisionCommit summaryAuthorDate
r106252follow up to r106220, code cleanupjeroendedauw22:08, 14 December 2011