$this->addWhereRange( 'cl_sortkey', $dir, null, null );
$this->addWhereRange( 'cl_from', $dir, null, null );
} else {
- $startsortkey = $params['startsortkeyprefix'] !== null ?
- Collation::singleton()->getSortkey( $params['startsortkeyprefix'] ) :
- $params['startsortkey'];
- $endsortkey = $params['endsortkeyprefix'] !== null ?
- Collation::singleton()->getSortkey( $params['endsortkeyprefix'] ) :
- $params['endsortkey'];
+ if ( $params['startsortkeyprefix'] !== null ) {
+ $startsortkey = Collation::singleton()->getSortkey( $params['startsortkeyprefix'] );
+ } elseif ( $params['starthexsortkey'] !== null ) {
+ $startsortkey = pack( 'H*', $params['starthexsortkey'] );
+ } else {
+ $this->logFeatureUsage( 'list=categorymembers&cmstartsortkey' );
+ $startsortkey = $params['startsortkey'];
+ }
+ if ( $params['endsortkeyprefix'] !== null ) {
+ $endsortkey = Collation::singleton()->getSortkey( $params['endsortkeyprefix'] );
+ } elseif ( $params['endhexsortkey'] !== null ) {
+ $endsortkey = pack( 'H*', $params['endhexsortkey'] );
+ } else {
+ $this->logFeatureUsage( 'list=categorymembers&cmendsortkey' );
+ $endsortkey = $params['endsortkey'];
+ }
// The below produces ORDER BY cl_sortkey, cl_from, possibly with DESC added to each of them
$this->addWhereRange( 'cl_sortkey',
'end' => array(
ApiBase::PARAM_TYPE => 'timestamp'
),
- 'startsortkey' => null,
- 'endsortkey' => null,
+ 'starthexsortkey' => null,
+ 'endhexsortkey' => null,
'startsortkeyprefix' => null,
'endsortkeyprefix' => null,
+ 'startsortkey' => array(
+ ApiBase::PARAM_DEPRECATED => true,
+ ),
+ 'endsortkey' => array(
+ ApiBase::PARAM_DEPRECATED => true,
+ ),
);
}
'dir' => 'In which direction to sort',
'start' => "Timestamp to start listing from. Can only be used with {$p}sort=timestamp",
'end' => "Timestamp to end listing at. Can only be used with {$p}sort=timestamp",
- 'startsortkey' => "Sortkey to start listing from. Must be given in " .
- "binary format. Can only be used with {$p}sort=sortkey",
- 'endsortkey' => "Sortkey to end listing at. Must be given in binary " .
- "format. Can only be used with {$p}sort=sortkey",
+ 'starthexsortkey' => "Sortkey to start listing from, as returned by prop=sortkey. " .
+ "Can only be used with {$p}sort=sortkey",
+ 'endhexsortkey' => "Sortkey to end listing from, as returned by prop=sortkey. " .
+ "Can only be used with {$p}sort=sortkey",
'startsortkeyprefix' => "Sortkey prefix to start listing from. Can " .
- "only be used with {$p}sort=sortkey. Overrides {$p}startsortkey",
+ "only be used with {$p}sort=sortkey. Overrides {$p}starthexsortkey",
'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",
+ "{$p}sort=sortkey. Overrides {$p}endhexsortkey",
+ 'startsortkey' => "Use starthexsortkey instead",
+ 'endsortkey' => "Use endhexsortkey instead",
'continue' => 'For large categories, give the value returned from previous query',
'limit' => 'The maximum number of pages to return.',
);