92 $this->mConds = $conds;
93 $this->articleID =
$source->getId();
96 $maxtimestamp = $dbr->newSelectQueryBuilder()
97 ->select(
'MIN(rev_timestamp)' )
99 ->where( [
'rev_page' => $dest->
getId() ] )
100 ->caller( __METHOD__ )->fetchField();
101 $maxRevId = $dbr->newSelectQueryBuilder()
102 ->select(
"MIN(rev_id)" )
104 ->where( [
'rev_page' => $dest->
getId() ] )
105 ->where( [
'rev_timestamp' => $maxtimestamp ] )
106 ->caller( __METHOD__ )->fetchField();
107 $this->maxTimestamp = $maxtimestamp;
108 $this->maxRevId = $maxRevId;
109 $this->mergePointTimestamp = $mergePointTimestamp;
113 parent::__construct( $context, $linkRenderer );
114 $this->linkBatchFactory = $linkBatchFactory;
115 $this->revisionStore = $revisionStore;
116 $this->commentFormatter = $commentFormatter;
120 # Do a link batch query
121 $this->mResult->seek( 0 );
122 $batch = $this->linkBatchFactory->newLinkBatch();
123 # Give some pointers to make (last) links
126 foreach ( $this->mResult as $row ) {
127 $batch->add(
NS_USER, $row->rev_user_text );
130 if ( isset( $rev_id ) ) {
131 if ( $rev_id > $row->rev_id ) {
132 $this->prevId[$rev_id] = $row->rev_id;
133 } elseif ( $rev_id < $row->rev_id ) {
134 $this->prevId[$row->rev_id] = $rev_id;
138 $rev_id = $row->rev_id;
142 $this->mResult->seek( 0 );
160 $revRecord = $this->revisionStore->newRevisionFromRow( $row );
165 $last = $this->
msg(
'last' )->escaped();
168 $tsWithId = $ts .
"|" . $row->rev_id;
170 'mergepoint', $tsWithId,
171 $this->mergePointTimestamp === $ts || $this->mergePointTimestamp === $tsWithId
176 $pageLink = $linkRenderer->makeKnownLink(
177 $revRecord->getPageAsLinkTarget(),
178 $this->getLanguage()->userTimeAndDate( $ts, $user ),
180 [
'oldid' => $revRecord->getId() ]
182 if ( $revRecord->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
183 $class = Linker::getRevisionDeletedClass( $revRecord );
184 $pageLink =
'<span class=" ' . $class .
'">' . $pageLink .
'</span>';
188 if ( !$revRecord->userCan( RevisionRecord::DELETED_TEXT, $this->getAuthority() ) ) {
189 $last = $this->
msg(
'last' )->escaped();
190 } elseif ( isset( $this->prevId[$row->rev_id] ) ) {
191 $last = $linkRenderer->makeKnownLink(
192 $revRecord->getPageAsLinkTarget(),
193 $this->msg(
'last' )->text(),
196 'diff' => $row->rev_id,
197 'oldid' => $this->prevId[$row->rev_id]
202 $userLink = Linker::revUserTools( $revRecord );
204 $size = $row->rev_len;
205 if ( $size !==
null ) {
206 $stxt = Linker::formatRevisionSize( $size );
208 $comment = $this->commentFormatter->formatRevision( $revRecord, $user );
217 return Html::rawElement(
'li', $classes,
218 $this->
msg(
'mergehistory-revisionrow' )
219 ->rawParams( $checkBox, $last, $pageLink, $userLink, $stxt, $comment, $tagSummary )->escaped() );