X-Git-Url: http://git.cyclocoop.org/%28?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryRevisions.php;h=3781ab0f3527ba4fc98d1405e28c83205b62cda0;hb=cb15755e92513eb61dcea6d7a0c0930374efdb86;hp=ac7ee0ae9f758b3e9bd13a40c1610a436f413dd1;hpb=a479750da672066b4189b115d1141a23d8c5cae3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index ac7ee0ae9f..3781ab0f35 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -84,7 +84,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase { } protected function run( ApiPageSet $resultPageSet = null ) { - global $wgActorTableSchemaMigrationStage, $wgChangeTagsSchemaMigrationStage; + global $wgActorTableSchemaMigrationStage; $params = $this->extractRequestParams( false ); $revisionStore = MediaWikiServices::getInstance()->getRevisionStore(); @@ -177,7 +177,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase { // Always join 'page' so orphaned revisions are filtered out $this->addTables( [ 'revision', 'page' ] ); $this->addJoinConds( - [ 'page' => [ 'INNER JOIN', [ 'page_id = rev_page' ] ] ] + [ 'page' => [ 'JOIN', [ 'page_id = rev_page' ] ] ] ); $this->addFields( [ 'rev_id' => $idField, 'rev_timestamp' => $tsField, 'rev_page' => $pageField @@ -185,28 +185,20 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase { } if ( $this->fld_tags ) { - $this->addTables( 'tag_summary' ); - $this->addJoinConds( - [ 'tag_summary' => [ 'LEFT JOIN', [ 'rev_id=ts_rev_id' ] ] ] - ); - $this->addFields( 'ts_tags' ); + $this->addFields( [ 'ts_tags' => ChangeTags::makeTagSummarySubquery( 'revision' ) ] ); } if ( $params['tag'] !== null ) { $this->addTables( 'change_tag' ); $this->addJoinConds( - [ 'change_tag' => [ 'INNER JOIN', [ 'rev_id=ct_rev_id' ] ] ] + [ 'change_tag' => [ 'JOIN', [ 'rev_id=ct_rev_id' ] ] ] ); - if ( $wgChangeTagsSchemaMigrationStage > MIGRATION_WRITE_BOTH ) { - $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore(); - try { - $this->addWhereFld( 'ct_tag_id', $changeTagDefStore->getId( $params['tag'] ) ); - } catch ( NameTableAccessException $exception ) { - // Return nothing. - $this->addWhere( '1=0' ); - } - } else { - $this->addWhereFld( 'ct_tag', $params['tag'] ); + $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore(); + try { + $this->addWhereFld( 'ct_tag_id', $changeTagDefStore->getId( $params['tag'] ) ); + } catch ( NameTableAccessException $exception ) { + // Return nothing. + $this->addWhere( '1=0' ); } } @@ -300,7 +292,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase { $ts = $db->addQuotes( $db->timestampOrNull( $params['start'] ) ); if ( $params['startid'] !== null ) { $this->addWhere( "$tsField $op $ts OR " - . "$tsField = $ts AND $idField $op= " . intval( $params['startid'] ) ); + . "$tsField = $ts AND $idField $op= " . (int)$params['startid'] ); } else { $this->addWhere( "$tsField $op= $ts" ); } @@ -310,7 +302,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase { $ts = $db->addQuotes( $db->timestampOrNull( $params['end'] ) ); if ( $params['endid'] !== null ) { $this->addWhere( "$tsField $op $ts OR " - . "$tsField = $ts AND $idField $op= " . intval( $params['endid'] ) ); + . "$tsField = $ts AND $idField $op= " . (int)$params['endid'] ); } else { $this->addWhere( "$tsField $op= $ts" ); } @@ -362,7 +354,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase { $this->addWhereFld( 'rev_id', array_keys( $revs ) ); if ( $params['continue'] !== null ) { - $this->addWhere( 'rev_id >= ' . intval( $params['continue'] ) ); + $this->addWhere( 'rev_id >= ' . (int)$params['continue'] ); } $this->addOption( 'ORDER BY', 'rev_id' ); } elseif ( $pageCount > 0 ) { @@ -382,8 +374,8 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase { if ( $params['continue'] !== null ) { $cont = explode( '|', $params['continue'] ); $this->dieContinueUsageIf( count( $cont ) != 2 ); - $pageid = intval( $cont[0] ); - $revid = intval( $cont[1] ); + $pageid = (int)$cont[0]; + $revid = (int)$cont[1]; $this->addWhere( "rev_page > $pageid OR " . "(rev_page = $pageid AND " . @@ -411,12 +403,12 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase { // additional pages to be had. Stop here... if ( $enumRevMode ) { $this->setContinueEnumParameter( 'continue', - $row->rev_timestamp . '|' . intval( $row->rev_id ) ); + $row->rev_timestamp . '|' . (int)$row->rev_id ); } elseif ( $revCount > 0 ) { - $this->setContinueEnumParameter( 'continue', intval( $row->rev_id ) ); + $this->setContinueEnumParameter( 'continue', (int)$row->rev_id ); } else { - $this->setContinueEnumParameter( 'continue', intval( $row->rev_page ) . - '|' . intval( $row->rev_id ) ); + $this->setContinueEnumParameter( 'continue', (int)$row->rev_page . + '|' . (int)$row->rev_id ); } break; } @@ -446,12 +438,12 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase { if ( !$fit ) { if ( $enumRevMode ) { $this->setContinueEnumParameter( 'continue', - $row->rev_timestamp . '|' . intval( $row->rev_id ) ); + $row->rev_timestamp . '|' . (int)$row->rev_id ); } elseif ( $revCount > 0 ) { - $this->setContinueEnumParameter( 'continue', intval( $row->rev_id ) ); + $this->setContinueEnumParameter( 'continue', (int)$row->rev_id ); } else { - $this->setContinueEnumParameter( 'continue', intval( $row->rev_page ) . - '|' . intval( $row->rev_id ) ); + $this->setContinueEnumParameter( 'continue', (int)$row->rev_page . + '|' . (int)$row->rev_id ); } break; }