r101448 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101447‎ | r101448 | r101449 >
Date:03:11, 1 November 2011
Author:reedy
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/REL1_18/phase3 (modified) (history)
  • /branches/REL1_18/phase3/includes (modified) (history)
  • /branches/REL1_18/phase3/includes/api (modified) (history)
  • /branches/REL1_18/phase3/includes/api/ApiQueryCategoryMembers.php (modified) (history)
  • /branches/wmf/1.18wmf1 (modified) (history)
  • /branches/wmf/1.18wmf1/includes (modified) (history)
  • /branches/wmf/1.18wmf1/includes/api (modified) (history)
  • /branches/wmf/1.18wmf1/includes/api/ApiQueryCategoryMembers.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/includes/api/ApiQueryCategoryMembers.php
@@ -147,11 +147,18 @@
148148 $this->addWhereRange( 'cl_sortkey', $dir, null, null );
149149 $this->addWhereRange( 'cl_from', $dir, null, null );
150150 } else {
 151+ $startsortkey = $params['startsortkeyprefix'] !== null ?
 152+ Collation::singleton()->getSortkey( $params['startsortkeyprefix'] ) :
 153+ $params['startsortkey'];
 154+ $endsortkey = $params['endsortkeyprefix'] !== null ?
 155+ Collation::singleton()->getSortkey( $params['endsortkeyprefix'] ) :
 156+ $params['endsortkey'];
 157+
151158 // The below produces ORDER BY cl_sortkey, cl_from, possibly with DESC added to each of them
152159 $this->addWhereRange( 'cl_sortkey',
153160 $dir,
154 - $params['startsortkey'],
155 - $params['endsortkey'] );
 161+ $startsortkey,
 162+ $endsortkey );
156163 $this->addWhereRange( 'cl_from', $dir, null, null );
157164 }
158165 $this->addOption( 'USE INDEX', 'cl_sortkey' );
@@ -325,6 +332,8 @@
326333 ),
327334 'startsortkey' => null,
328335 'endsortkey' => null,
 336+ 'startsortkeyprefix' => null,
 337+ 'endsortkeyprefix' => null,
329338 );
330339 }
331340
@@ -351,6 +360,8 @@
352361 'end' => "Timestamp to end listing at. Can only be used with {$p}sort=timestamp",
353362 'startsortkey' => "Sortkey to start listing from. Must be given in binary format. Can only be used with {$p}sort=sortkey",
354363 'endsortkey' => "Sortkey to end listing at. Must be given in binary format. Can only be used with {$p}sort=sortkey",
 364+ 'startsortkeyprefix' => "Sortkey prefix to start listing from. Can only be used with {$p}sort=sortkey. Overrides {$p}startsortkey",
 365+ 'endsortkeyprefix' => "Sortkey prefix to end listing BEFORE (not at, if this value occurs it will not be included!). Can only be used with {$p}sort=sortkey. Overrides {$p}endsortkey",
355366 'continue' => 'For large categories, give the value retured from previous query',
356367 'limit' => 'The maximum number of pages to return.',
357368 );
Property changes on: branches/REL1_18/phase3/includes/api
___________________________________________________________________
Modified: svn:mergeinfo
358369 Merged /trunk/phase3/includes/api:r101306
Property changes on: branches/REL1_18/phase3/includes
___________________________________________________________________
Modified: svn:mergeinfo
359370 Merged /trunk/phase3/includes:r101306
Property changes on: branches/REL1_18/phase3
___________________________________________________________________
Modified: svn:mergeinfo
360371 Merged /trunk/phase3:r101306
Index: branches/wmf/1.18wmf1/includes/api/ApiQueryCategoryMembers.php
@@ -147,11 +147,18 @@
148148 $this->addWhereRange( 'cl_sortkey', $dir, null, null );
149149 $this->addWhereRange( 'cl_from', $dir, null, null );
150150 } else {
 151+ $startsortkey = $params['startsortkeyprefix'] !== null ?
 152+ Collation::singleton()->getSortkey( $params['startsortkeyprefix'] ) :
 153+ $params['startsortkey'];
 154+ $endsortkey = $params['endsortkeyprefix'] !== null ?
 155+ Collation::singleton()->getSortkey( $params['endsortkeyprefix'] ) :
 156+ $params['endsortkey'];
 157+
151158 // The below produces ORDER BY cl_sortkey, cl_from, possibly with DESC added to each of them
152159 $this->addWhereRange( 'cl_sortkey',
153160 $dir,
154 - $params['startsortkey'],
155 - $params['endsortkey'] );
 161+ $startsortkey,
 162+ $endsortkey );
156163 $this->addWhereRange( 'cl_from', $dir, null, null );
157164 }
158165 $this->addOption( 'USE INDEX', 'cl_sortkey' );
@@ -325,6 +332,8 @@
326333 ),
327334 'startsortkey' => null,
328335 'endsortkey' => null,
 336+ 'startsortkeyprefix' => null,
 337+ 'endsortkeyprefix' => null,
329338 );
330339 }
331340
@@ -351,6 +360,8 @@
352361 'end' => "Timestamp to end listing at. Can only be used with {$p}sort=timestamp",
353362 'startsortkey' => "Sortkey to start listing from. Must be given in binary format. Can only be used with {$p}sort=sortkey",
354363 'endsortkey' => "Sortkey to end listing at. Must be given in binary format. Can only be used with {$p}sort=sortkey",
 364+ 'startsortkeyprefix' => "Sortkey prefix to start listing from. Can only be used with {$p}sort=sortkey. Overrides {$p}startsortkey",
 365+ 'endsortkeyprefix' => "Sortkey prefix to end listing BEFORE (not at, if this value occurs it will not be included!). Can only be used with {$p}sort=sortkey. Overrides {$p}endsortkey",
355366 'continue' => 'For large categories, give the value retured from previous query',
356367 'limit' => 'The maximum number of pages to return.',
357368 );
Property changes on: branches/wmf/1.18wmf1/includes/api
___________________________________________________________________
Modified: svn:mergeinfo
358369 Merged /trunk/phase3/includes/api:r101306
Property changes on: branches/wmf/1.18wmf1/includes
___________________________________________________________________
Modified: svn:mergeinfo
359370 Merged /trunk/phase3/includes:r101306
Property changes on: branches/wmf/1.18wmf1
___________________________________________________________________
Modified: svn:mergeinfo
360371 Merged /trunk/phase3:r101306

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r101306Introduce cmstartsortkeyprefix and cmendsortkeyprefix parameters so categoriz...catrope18:49, 30 October 2011

Status & tagging log