X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fapi%2FApiQueryAllDeletedRevisions.php;h=f885b729b1537901c47d35b41b3a2bf8bde9dc25;hp=b22bb1ff15858d83cec79cbaabf1f69919bf89dd;hb=27c61fb1e94da9114314468fd00bcf129ec064b6;hpb=5049af1048c77b1ea6ab3193688d23a48ddf8df0 diff --git a/includes/api/ApiQueryAllDeletedRevisions.php b/includes/api/ApiQueryAllDeletedRevisions.php index b22bb1ff15..f885b729b1 100644 --- a/includes/api/ApiQueryAllDeletedRevisions.php +++ b/includes/api/ApiQueryAllDeletedRevisions.php @@ -1,7 +1,5 @@ addTables( 'archive' ); if ( $resultPageSet === null ) { $this->parseParameters( $params ); - $this->addFields( Revision::selectArchiveFields() ); + $arQuery = Revision::getArchiveQueryInfo(); + $this->addTables( $arQuery['tables'] ); + $this->addJoinConds( $arQuery['joins'] ); + $this->addFields( $arQuery['fields'] ); $this->addFields( [ 'ar_title', 'ar_namespace' ] ); } else { $this->limit = $this->getParameter( 'limit' ) ?: 10; + $this->addTables( 'archive' ); $this->addFields( [ 'ar_title', 'ar_namespace' ] ); if ( $optimizeGenerateTitles ) { $this->addOption( 'DISTINCT' ); @@ -223,10 +224,19 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase { } if ( !is_null( $params['user'] ) ) { - $this->addWhereFld( 'ar_user_text', $params['user'] ); + // Don't query by user ID here, it might be able to use the ar_usertext_timestamp index. + $actorQuery = ActorMigration::newMigration() + ->getWhere( $db, 'ar_user', User::newFromName( $params['user'], false ), false ); + $this->addTables( $actorQuery['tables'] ); + $this->addJoinConds( $actorQuery['joins'] ); + $this->addWhere( $actorQuery['conds'] ); } elseif ( !is_null( $params['excludeuser'] ) ) { - $this->addWhere( 'ar_user_text != ' . - $db->addQuotes( $params['excludeuser'] ) ); + // Here there's no chance of using ar_usertext_timestamp. + $actorQuery = ActorMigration::newMigration() + ->getWhere( $db, 'ar_user', User::newFromName( $params['excludeuser'], false ) ); + $this->addTables( $actorQuery['tables'] ); + $this->addJoinConds( $actorQuery['joins'] ); + $this->addWhere( 'NOT(' . $actorQuery['conds'] . ')' ); } if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) {