From 27c9ee9089970f695aee4c93c6564a2287958ecb Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Mon, 21 Jan 2013 07:52:43 +0100 Subject: [PATCH] Use a LinkBatch for the creator/last editor user (talk) pages in InfoAction This avoid having to do four single queries to know whether these pages exist. Change-Id: I98b8c84abb2fc64c00fc2f3177b95c62c9606536 --- includes/actions/InfoAction.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index dedc61f29e..a627125510 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -386,6 +386,22 @@ class InfoAction extends FormlessAction { $pageInfo['header-edits'] = array(); $firstRev = $this->page->getOldestRevision(); + $lastRev = $this->page->getRevision(); + $batch = new LinkBatch; + + $firstRevUser = $firstRev->getUserText( Revision::FOR_THIS_USER ); + if ( $firstRevUser !== '' ) { + $batch->add( NS_USER, $firstRevUser ); + $batch->add( NS_USER_TALK, $firstRevUser ); + } + + $lastRevUser = $lastRev->getUserText( Revision::FOR_THIS_USER ); + if ( $lastRevUser !== '' ) { + $batch->add( NS_USER, $lastRevUser ); + $batch->add( NS_USER_TALK, $lastRevUser ); + } + + $batch->execute(); // Page creator $pageInfo['header-edits'][] = array( @@ -407,7 +423,7 @@ class InfoAction extends FormlessAction { // Latest editor $pageInfo['header-edits'][] = array( $this->msg( 'pageinfo-lastuser' ), - Linker::revUserTools( $this->page->getRevision() ) + Linker::revUserTools( $lastRev ) ); // Date of latest edit -- 2.20.1