r110885 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110884‎ | r110885 | r110886 >
Date:22:22, 7 February 2012
Author:aaron
Status:ok
Tags:
Comment:
Made LogEntry::getPerformer() not fail miserable if we got the LogEntry via newFromRow() on just a logging table row. Previously, the current user IP would show.
Modified paths:
  • /trunk/phase3/includes/logging/LogEntry.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/logging/LogEntry.php
@@ -217,9 +217,13 @@
218218
219219 public function getPerformer() {
220220 $userId = (int) $this->row->log_user;
221 - if ( $userId !== 0 ) {
222 - return User::newFromRow( $this->row );
223 - } else {
 221+ if ( $userId !== 0 ) { // logged-in users
 222+ if ( isset( $this->row->user_name ) ) {
 223+ return User::newFromRow( $this->row );
 224+ } else {
 225+ return User::newFromId( $userId );
 226+ }
 227+ } else { // IP users
224228 $userText = $this->row->log_user_text;
225229 return User::newFromName( $userText, false );
226230 }

Status & tagging log