From 9e549e437a45388fc23280b36ccac50f8d193c9f Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 17 Oct 2010 18:54:39 +0000 Subject: [PATCH] Followup r74392. Also cache result of getUser call (may be called twice) --- includes/api/ApiQueryRevisions.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index a8f83a2e22..c495d3b7cb 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -376,13 +376,14 @@ class ApiQueryRevisions extends ApiQueryBase { if ( $this->fld_user ) { $vals['user'] = $revision->getUserText(); } - if ( $this->fld_userid ) { - $user = User::newFromName( $revision->getUserText() ); - $vals['userid'] = $user->getId(); - } - if ( !$revision->getUser() ) { + $userid = $revision->getUser(); + if ( !$userid ) { $vals['anon'] = ''; } + + if ( $this->fld_userid ) { + $vals['userid'] = $userid; + } } } -- 2.20.1