From: Sam Reed Date: Sun, 17 Oct 2010 18:54:39 +0000 (+0000) Subject: Followup r74392. Also cache result of getUser call (may be called twice) X-Git-Tag: 1.31.0-rc.0~34463 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/voir.php?a=commitdiff_plain;h=9e549e437a45388fc23280b36ccac50f8d193c9f;p=lhc%2Fweb%2Fwiklou.git Followup r74392. Also cache result of getUser call (may be called twice) --- 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; + } } }