aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api/ApiQueryLogEvents.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiQueryLogEvents.php')
-rw-r--r--includes/api/ApiQueryLogEvents.php25
1 files changed, 14 insertions, 11 deletions
diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php
index 0630dc738478..07a5ff6457f8 100644
--- a/includes/api/ApiQueryLogEvents.php
+++ b/includes/api/ApiQueryLogEvents.php
@@ -107,10 +107,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
$this->addWhere( $hideLogs );
}
- $this->addTables( [ 'logging', 'actor' ] );
- $this->addJoinConds( [
- 'actor' => [ 'JOIN', 'actor_id=log_actor' ],
- ] );
+ $this->addTables( 'logging' );
$this->addFields( [
'log_id',
@@ -120,6 +117,19 @@ class ApiQueryLogEvents extends ApiQueryBase {
'log_deleted',
] );
+ $user = $params['user'];
+ if ( $this->fld_user || $this->fld_userid || $user !== null ) {
+ $this->addTables( 'actor' );
+ $this->addJoinConds( [
+ 'actor' => [ 'JOIN', 'actor_id=log_actor' ],
+ ] );
+ $this->addFieldsIf( [ 'actor_name', 'actor_user' ], $this->fld_user );
+ $this->addFieldsIf( 'actor_user', $this->fld_userid );
+ if ( $user !== null ) {
+ $this->addWhereFld( 'actor_name', $user );
+ }
+ }
+
if ( $this->fld_ids ) {
$this->addTables( 'page' );
$this->addJoinConds( [
@@ -132,8 +142,6 @@ class ApiQueryLogEvents extends ApiQueryBase {
// scenarios, e.g. deletion, recreation.
$this->addFields( [ 'page_id', 'log_page' ] );
}
- $this->addFieldsIf( [ 'actor_name', 'actor_user' ], $this->fld_user );
- $this->addFieldsIf( 'actor_user', $this->fld_userid );
$this->addFieldsIf(
[ 'log_namespace', 'log_title' ],
$this->fld_title || $this->fld_parsedcomment
@@ -213,11 +221,6 @@ class ApiQueryLogEvents extends ApiQueryBase {
$limit = $params['limit'];
$this->addOption( 'LIMIT', $limit + 1 );
- $user = $params['user'];
- if ( $user !== null ) {
- $this->addWhereFld( 'actor_name', $user );
- }
-
$title = $params['title'];
if ( $title !== null ) {
$titleObj = Title::newFromText( $title );