From 1782513c431dac352ee6563a9ec858d9a2b8a2b7 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Sat, 29 Jun 2013 20:18:38 +0100 Subject: [PATCH] Make list=logevents display log entries by anonymous users Also fix warnings being shown and "anon" property being given to non-anon entries when "userid" leprop was used but no "user". Bug: 50315 Change-Id: I4df1c8c1040fb39d75ead5851d42b02d9de87a5a --- RELEASE-NOTES-1.22 | 1 + includes/api/ApiQueryLogEvents.php | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index ca653efa6b..8074db714b 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -156,6 +156,7 @@ production. requested. * Special:Recentchangeslinked will now include upload log entries * (bug 41281) Fixed ugly output if file size could not be extracted for multi-page media. +* (bug 50315) list=logevents API module will now output log entries by anonymous users. === API changes in 1.22 === * (bug 25553) The JSON output formatter now leaves forward slashes unescaped diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index 2aa5c28e92..96d02daa55 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -67,7 +67,7 @@ class ApiQueryLogEvents extends ApiQueryBase { $this->addTables( array( 'logging', 'user', 'page' ) ); $this->addOption( 'STRAIGHT_JOIN' ); $this->addJoinConds( array( - 'user' => array( 'JOIN', + 'user' => array( 'LEFT JOIN', 'user_id=log_user' ), 'page' => array( 'LEFT JOIN', array( 'log_namespace=page_namespace', @@ -82,8 +82,8 @@ class ApiQueryLogEvents extends ApiQueryBase { ) ); $this->addFieldsIf( array( 'log_id', 'page_id' ), $this->fld_ids ); - $this->addFieldsIf( array( 'log_user', 'user_name' ), $this->fld_user ); - $this->addFieldsIf( 'user_id', $this->fld_userid ); + $this->addFieldsIf( array( 'log_user', 'log_user_text', 'user_name' ), $this->fld_user ); + $this->addFieldsIf( 'log_user', $this->fld_userid ); $this->addFieldsIf( array( 'log_namespace', 'log_title' ), $this->fld_title || $this->fld_parsedcomment ); $this->addFieldsIf( 'log_comment', $this->fld_comment || $this->fld_parsedcomment ); $this->addFieldsIf( 'log_params', $this->fld_details ); @@ -336,10 +336,10 @@ class ApiQueryLogEvents extends ApiQueryBase { $vals['userhidden'] = ''; } else { if ( $this->fld_user ) { - $vals['user'] = $row->user_name; + $vals['user'] = $row->user_name === null ? $row->log_user_text : $row->user_name; } if ( $this->fld_userid ) { - $vals['userid'] = $row->user_id; + $vals['userid'] = $row->log_user; } if ( !$row->log_user ) { -- 2.20.1