mForm = $form; $this->mConds = $conds; $this->title = $source; $this->articleID = $source->getArticleID(); $dbr = wfGetDB( DB_SLAVE ); $maxtimestamp = $dbr->selectField( 'revision', 'MIN(rev_timestamp)', [ 'rev_page' => $dest->getArticleID() ], __METHOD__ ); $this->maxTimestamp = $maxtimestamp; parent::__construct( $form->getContext() ); } function getStartBody() { # Do a link batch query $this->mResult->seek( 0 ); $batch = new LinkBatch(); # Give some pointers to make (last) links $this->mForm->prevId = []; foreach ( $this->mResult as $row ) { $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) ); $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) ); $rev_id = isset( $rev_id ) ? $rev_id : $row->rev_id; if ( $rev_id > $row->rev_id ) { $this->mForm->prevId[$rev_id] = $row->rev_id; } elseif ( $rev_id < $row->rev_id ) { $this->mForm->prevId[$row->rev_id] = $rev_id; } $rev_id = $row->rev_id; } $batch->execute(); $this->mResult->seek( 0 ); return ''; } function formatRow( $row ) { return $this->mForm->formatRevisionRow( $row ); } function getQueryInfo() { $conds = $this->mConds; $conds['rev_page'] = $this->articleID; $conds[] = "rev_timestamp < " . $this->mDb->addQuotes( $this->maxTimestamp ); return [ 'tables' => [ 'revision', 'page', 'user' ], 'fields' => array_merge( Revision::selectFields(), Revision::selectUserFields() ), 'conds' => $conds, 'join_conds' => [ 'page' => Revision::pageJoinCond(), 'user' => Revision::userJoinCond() ] ]; } function getIndexField() { return 'rev_timestamp'; } }