X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryRecentChanges.php;h=8b11dc2a47d2169c9976594f48e9ca2a5afd6110;hb=861739f340cace483812af9398f3576eb653fef1;hp=63c95d36750a31adf0fc24d7b7a9b715654b9c0e;hpb=ef06c85d9b4e260ce586e546a35648ae35f3e24a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index 63c95d3675..8b11dc2a47 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 @@ -361,9 +361,10 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { $this->token = $params['token']; $this->addOption( 'LIMIT', $params['limit'] + 1 ); + $hookData = []; $count = 0; /* Perform the actual query. */ - $res = $this->select( __METHOD__ ); + $res = $this->select( __METHOD__, [], $hookData ); $revids = []; $titles = []; @@ -372,6 +373,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... @@ -384,7 +392,8 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { $vals = $this->extractRowInfo( $row ); /* Add that row's data to our final output. */ - $fit = $result->addValue( [ 'query', $this->getModuleName() ], null, $vals ); + $fit = $this->processRow( $row, $vals, $hookData ) && + $result->addValue( [ 'query', $this->getModuleName() ], null, $vals ); if ( !$fit ) { $this->setContinueEnumParameter( 'continue', "$row->rc_timestamp|$row->rc_id" ); break;