X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryRecentChanges.php;h=c4c8afbdbf111b084a3d0e4413456b464600e7c2;hb=bcd377cd008f8a8628ab727c3fa90090725d6c10;hp=f0fd2f4574b5229caf405dd61d4da116f2cff79e;hpb=17395ea3d473219259b87de1770c5d3d08961444;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index f0fd2f4574..c4c8afbdbf 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -48,7 +48,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { * The prototype for a token function is func($pageid, $title, $rc) * it should return a token or false (permission denied) * @deprecated since 1.24 - * @return array Array(tokenname => function) + * @return array [ tokenname => function ] */ protected function getTokenFunctions() { // Don't call the hooks twice @@ -150,7 +150,6 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { * AND rc_timestamp < $end AND rc_namespace = $namespace */ $this->addTables( 'recentchanges' ); - $index = [ 'recentchanges' => 'rc_timestamp' ]; // May change $this->addTimestampWhereRange( 'rc_timestamp', $params['dir'], $params['start'], $params['end'] ); if ( !is_null( $params['continue'] ) ) { @@ -246,7 +245,6 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { if ( !is_null( $params['user'] ) ) { $this->addWhereFld( 'rc_user_text', $params['user'] ); - $index['recentchanges'] = 'rc_user_text'; } if ( !is_null( $params['excludeuser'] ) ) { @@ -362,7 +360,6 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { $this->token = $params['token']; $this->addOption( 'LIMIT', $params['limit'] + 1 ); - $this->addOption( 'USE INDEX', $index ); $count = 0; /* Perform the actual query. */ @@ -375,6 +372,13 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { /* Iterate through the rows, adding data extracted from them to our query result. */ foreach ( $res as $row ) { + if ( $count === 0 && $resultPageSet !== null ) { + // Set the non-continue since the list of recentchanges is + // prone to having entries added at the start frequently. + $this->getContinuationManager()->addGeneratorNonContinueParam( + $this, 'continue', "$row->rc_timestamp|$row->rc_id" + ); + } if ( ++$count > $params['limit'] ) { // We've reached the one extra which shows that there are // additional pages to be had. Stop here...