$this->mLogEventsList = $list;
$this->limitType( $types ); // also excludes hidden types
+ $this->limitLogId( $logId );
+ $this->limitFilterTypes();
$this->limitPerformer( $performer );
$this->limitTitle( $title, $pattern );
$this->limitAction( $action );
$this->getDateCond( $year, $month, $day );
$this->mTagFilter = $tagFilter;
- $this->limitLogId( $logId );
$this->mDb = wfGetDB( DB_REPLICA, 'logpager' );
}
return $query;
}
- // Call ONLY after calling $this->limitType() already!
+ private function limitFilterTypes() {
+ if ( $this->hasEqualsClause( 'log_id' ) ) { // T220834
+ return;
+ }
+ $filterTypes = $this->getFilterParams();
+ foreach ( $filterTypes as $type => $hide ) {
+ if ( $hide ) {
+ $this->mConds[] = 'log_type != ' . $this->mDb->addQuotes( $type );
+ }
+ }
+ }
+
public function getFilterParams() {
global $wgFilterLogTypes;
$filters = [];
}
$filters[$type] = $hide;
- if ( $hide ) {
- $this->mConds[] = 'log_type != ' . $this->mDb->addQuotes( $type );
- }
}
return $filters;
if ( !$this->mTagFilter && !array_key_exists( 'ls_field', $this->mConds ) ) {
$options[] = 'STRAIGHT_JOIN';
}
+ if ( $this->performer !== '' ) {
+ // T223151: MariaDB's optimizer, at least 10.1, likes to choose a wildly bad plan for
+ // some reason for this code path. Tell it not to use the wrong index it wants to pick.
+ $options['IGNORE INDEX'] = [ 'logging' => [ 'times' ] ];
+ }
$info = [
'tables' => $tables,