X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryCategoryMembers.php;h=424770fc5c6331e08ec2f4a00b67a26913ae4c47;hb=a8304d4c73fd04c338ae23f3028fc475921cc0fa;hp=f7bd59a5b552218c339c948e66e627109d182f33;hpb=70ae276db1c02e82d2f324c658fe1f61c7a204d0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryCategoryMembers.php b/includes/api/ApiQueryCategoryMembers.php index f7bd59a5b5..424770fc5c 100644 --- a/includes/api/ApiQueryCategoryMembers.php +++ b/includes/api/ApiQueryCategoryMembers.php @@ -101,6 +101,22 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { $dir, $params['start'], $params['end'] ); + // Include in ORDER BY for uniqueness + $this->addWhereRange( 'cl_from', $dir, null, null ); + + if ( !is_null( $params['continue'] ) ) { + $cont = explode( '|', $params['continue'] ); + $this->dieContinueUsageIf( count( $cont ) != 2 ); + $op = ( $dir === 'newer' ? '>' : '<' ); + $db = $this->getDB(); + $continueTimestamp = $db->addQuotes( $db->timestamp( $cont[0] ) ); + $continueFrom = (int)$cont[1]; + $this->dieContinueUsageIf( $continueFrom != $cont[1] ); + $this->addWhere( "cl_timestamp $op $continueTimestamp OR " . + "(cl_timestamp = $continueTimestamp AND " . + "cl_from $op= $continueFrom)" + ); + } $this->addOption( 'USE INDEX', 'cl_timestamp' ); } else { @@ -186,7 +202,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { // @todo Security issue - if the user has no right to view next // title, it will still be shown if ( $params['sort'] == 'timestamp' ) { - $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->cl_timestamp ) ); + $this->setContinueEnumParameter( 'continue', "$row->cl_timestamp|$row->cl_from" ); } else { $sortkey = bin2hex( $row->cl_sortkey ); $this->setContinueEnumParameter( 'continue', @@ -229,7 +245,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { null, $vals ); if ( !$fit ) { if ( $params['sort'] == 'timestamp' ) { - $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->cl_timestamp ) ); + $this->setContinueEnumParameter( 'continue', "$row->cl_timestamp|$row->cl_from" ); } else { $sortkey = bin2hex( $row->cl_sortkey ); $this->setContinueEnumParameter( 'continue', @@ -401,7 +417,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { } public function getDescription() { - return 'List all pages in a given category'; + return 'List all pages in a given category.'; } public function getPossibleErrors() {