X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryRevisions.php;h=2dfa42a3a4d6346b36307be8e01e092e5260fa84;hb=75a3043b71e96dff59f3559eba62dd2c6e5b86b6;hp=b0a8468428c5fac269a518c708f8a160c6d05355;hpb=09736bd00d0b77465befc1c2d3898529bc7a6b37;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index b0a8468428..2dfa42a3a4 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -166,7 +166,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase { // For each page we will request, the user must have read rights for that page $user = $this->getUser(); $status = Status::newGood(); - /** @var $title Title */ + /** @var Title $title */ foreach ( $pageSet->getGoodTitles() as $title ) { if ( !$title->userCan( 'read', $user ) ) { $status->fatal( ApiMessage::create( @@ -219,26 +219,26 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase { } // Convert startid/endid to timestamps (T163532) - if ( $params['startid'] !== null || $params['endid'] !== null ) { - $ids = [ - (int)$params['startid'] => true, - (int)$params['endid'] => true, - ]; - unset( $ids[0] ); // null - $ids = array_keys( $ids ); - + $revids = []; + if ( $params['startid'] !== null ) { + $revids[] = (int)$params['startid']; + } + if ( $params['endid'] !== null ) { + $revids[] = (int)$params['endid']; + } + if ( $revids ) { $db = $this->getDB(); $sql = $db->unionQueries( [ $db->selectSQLText( 'revision', [ 'id' => 'rev_id', 'ts' => 'rev_timestamp' ], - [ 'rev_id' => $ids ], + [ 'rev_id' => $revids ], __METHOD__ ), $db->selectSQLText( 'archive', [ 'id' => 'ar_rev_id', 'ts' => 'ar_timestamp' ], - [ 'ar_rev_id' => $ids ], + [ 'ar_rev_id' => $revids ], __METHOD__ ), ], false );