3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
25 class MergeHistoryPager
extends ReverseChronologicalPager
{
27 /** @var SpecialMergeHistory */
37 private $maxTimestamp;
39 public function __construct( SpecialMergeHistory
$form, $conds, Title
$source, Title
$dest ) {
41 $this->mConds
= $conds;
42 $this->articleID
= $source->getArticleID();
44 $dbr = wfGetDB( DB_REPLICA
);
45 $maxtimestamp = $dbr->selectField(
48 [ 'rev_page' => $dest->getArticleID() ],
51 $this->maxTimestamp
= $maxtimestamp;
53 parent
::__construct( $form->getContext() );
56 protected function getStartBody() {
57 # Do a link batch query
58 $this->mResult
->seek( 0 );
59 $batch = new LinkBatch();
60 # Give some pointers to make (last) links
61 $this->mForm
->prevId
= [];
63 foreach ( $this->mResult
as $row ) {
64 $batch->addObj( Title
::makeTitleSafe( NS_USER
, $row->user_name
) );
65 $batch->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->user_name
) );
67 if ( isset( $rev_id ) ) {
68 if ( $rev_id > $row->rev_id
) {
69 $this->mForm
->prevId
[$rev_id] = $row->rev_id
;
70 } elseif ( $rev_id < $row->rev_id
) {
71 $this->mForm
->prevId
[$row->rev_id
] = $rev_id;
75 $rev_id = $row->rev_id
;
79 $this->mResult
->seek( 0 );
84 function formatRow( $row ) {
85 return $this->mForm
->formatRevisionRow( $row );
88 function getQueryInfo() {
89 $conds = $this->mConds
;
90 $conds['rev_page'] = $this->articleID
;
91 $conds[] = "rev_timestamp < " . $this->mDb
->addQuotes( $this->maxTimestamp
);
93 $revQuery = Revision
::getQueryInfo( [ 'page', 'user' ] );
95 'tables' => $revQuery['tables'],
96 'fields' => $revQuery['fields'],
98 'join_conds' => $revQuery['joins']
102 function getIndexField() {
103 return 'rev_timestamp';