91 $this->mConds = $conds;
92 $this->articleID =
$source->getId();
95 $maxtimestamp = $dbr->newSelectQueryBuilder()
96 ->select(
'MIN(rev_timestamp)' )
98 ->where( [
'rev_page' => $dest->
getId() ] )
99 ->caller( __METHOD__ )->fetchField();
100 $maxRevId = $dbr->newSelectQueryBuilder()
101 ->select(
"MIN(rev_id)" )
103 ->where( [
'rev_page' => $dest->
getId() ] )
104 ->where( [
'rev_timestamp' => $maxtimestamp ] )
105 ->caller( __METHOD__ )->fetchField();
106 $this->maxTimestamp = $maxtimestamp;
107 $this->maxRevId = $maxRevId;
108 $this->mergePointTimestamp = $mergePointTimestamp;
112 parent::__construct( $context, $linkRenderer );
113 $this->linkBatchFactory = $linkBatchFactory;
114 $this->revisionStore = $revisionStore;
115 $this->commentFormatter = $commentFormatter;
119 # Do a link batch query
120 $this->mResult->seek( 0 );
121 $batch = $this->linkBatchFactory->newLinkBatch();
122 # Give some pointers to make (last) links
125 foreach ( $this->mResult as $row ) {
126 $batch->add(
NS_USER, $row->rev_user_text );
129 if ( isset( $rev_id ) ) {
130 if ( $rev_id > $row->rev_id ) {
131 $this->prevId[$rev_id] = $row->rev_id;
132 } elseif ( $rev_id < $row->rev_id ) {
133 $this->prevId[$row->rev_id] = $rev_id;
137 $rev_id = $row->rev_id;
141 $this->mResult->seek( 0 );
159 $revRecord = $this->revisionStore->newRevisionFromRow( $row );
164 $last = $this->
msg(
'last' )->escaped();
167 $tsWithId = $ts .
"|" . $row->rev_id;
168 $checkBox = Xml::radio(
169 'mergepoint', $tsWithId,
170 $this->mergePointTimestamp === $ts || $this->mergePointTimestamp === $tsWithId
175 $pageLink = $linkRenderer->makeKnownLink(
176 $revRecord->getPageAsLinkTarget(),
177 $this->getLanguage()->userTimeAndDate( $ts, $user ),
179 [
'oldid' => $revRecord->getId() ]
181 if ( $revRecord->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
182 $class = Linker::getRevisionDeletedClass( $revRecord );
183 $pageLink =
'<span class=" ' . $class .
'">' . $pageLink .
'</span>';
187 if ( !$revRecord->userCan( RevisionRecord::DELETED_TEXT, $this->getAuthority() ) ) {
188 $last = $this->
msg(
'last' )->escaped();
189 } elseif ( isset( $this->prevId[$row->rev_id] ) ) {
190 $last = $linkRenderer->makeKnownLink(
191 $revRecord->getPageAsLinkTarget(),
192 $this->msg(
'last' )->text(),
195 'diff' => $row->rev_id,
196 'oldid' => $this->prevId[$row->rev_id]
201 $userLink = Linker::revUserTools( $revRecord );
203 $size = $row->rev_len;
204 if ( $size !==
null ) {
205 $stxt = Linker::formatRevisionSize( $size );
207 $comment = $this->commentFormatter->formatRevision( $revRecord, $user );
216 return Html::rawElement(
'li', $classes,
217 $this->
msg(
'mergehistory-revisionrow' )
218 ->rawParams( $checkBox, $last, $pageLink, $userLink, $stxt, $comment, $tagSummary )->escaped() );