71 string $mergePointTimestamp
73 $this->mConds = $conds;
74 $this->articleID =
$source->getId();
77 $maxtimestamp = $dbr->newSelectQueryBuilder()
78 ->select(
'MIN(rev_timestamp)' )
80 ->where( [
'rev_page' => $dest->
getId() ] )
81 ->caller( __METHOD__ )->fetchField();
82 $maxRevId = $dbr->newSelectQueryBuilder()
83 ->select(
"MIN(rev_id)" )
85 ->where( [
'rev_page' => $dest->
getId() ] )
86 ->where( [
'rev_timestamp' => $maxtimestamp ] )
87 ->caller( __METHOD__ )->fetchField();
88 $this->maxTimestamp = $maxtimestamp;
89 $this->maxRevId = (int)$maxRevId;
90 $this->mergePointTimestamp = $mergePointTimestamp;
94 parent::__construct( $context, $linkRenderer );
95 $this->linkBatchFactory = $linkBatchFactory;
96 $this->revisionStore = $revisionStore;
97 $this->commentFormatter = $commentFormatter;
98 $this->changeTagsStore = $changeTagsStore;
102 # Do a link batch query
103 $this->mResult->seek( 0 );
104 $batch = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
105 # Give some pointers to make (last) links
108 foreach ( $this->mResult as $row ) {
109 $batch->addUser(
new UserIdentityValue( (
int)$row->rev_user, $row->rev_user_text ) );
111 if ( $rev_id !==
null ) {
112 if ( $rev_id > $row->rev_id ) {
113 $this->prevId[$rev_id] = $row->rev_id;
114 } elseif ( $rev_id < $row->rev_id ) {
115 $this->prevId[$row->rev_id] = $rev_id;
119 $rev_id = $row->rev_id;
123 $this->mResult->seek( 0 );
141 $revRecord = $this->revisionStore->newRevisionFromRow( $row );
146 $last = $this->
msg(
'last' )->escaped();
149 $tsWithId = $ts .
"|" . $row->rev_id;
150 $checkBox = Html::radio(
152 $this->mergePointTimestamp === $ts || $this->mergePointTimestamp === $tsWithId,
153 [
'value' => $tsWithId ]
158 $pageLink = $linkRenderer->makeKnownLink(
159 $revRecord->getPageAsLinkTarget(),
160 $this->getLanguage()->userTimeAndDate( $ts, $user ),
162 [
'oldid' => $revRecord->getId() ]
164 if ( $revRecord->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
165 $class = Linker::getRevisionDeletedClass( $revRecord );
166 $pageLink =
'<span class=" ' . $class .
'">' . $pageLink .
'</span>';
170 if ( !$revRecord->userCan( RevisionRecord::DELETED_TEXT, $this->getAuthority() ) ) {
171 $last = $this->
msg(
'last' )->escaped();
172 } elseif ( isset( $this->prevId[$row->rev_id] ) ) {
173 $last = $linkRenderer->makeKnownLink(
174 $revRecord->getPageAsLinkTarget(),
175 $this->msg(
'last' )->text(),
178 'diff' => $row->rev_id,
179 'oldid' => $this->prevId[$row->rev_id]
184 $userLink = Linker::revUserTools( $revRecord );
186 $size = $row->rev_len;
187 if ( $size !==
null ) {
188 $stxt = Linker::formatRevisionSize( $size );
190 $comment = $this->commentFormatter->formatRevision( $revRecord, $user );
193 [ $tagSummary, $classes ] = ChangeTags::formatSummaryRow(
199 return Html::rawElement(
'li', $classes,
200 $this->
msg(
'mergehistory-revisionrow' )
201 ->rawParams( $checkBox, $last, $pageLink, $userLink, $stxt, $comment, $tagSummary )->escaped() );