mForm = $form; $this->mConds = $conds; $this->title = $source; $this->articleID = $source->getArticleID(); $dbr = wfGetDB( DB_REPLICA ); $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 = []; $rev_id = null; foreach ( $this->mResult as $row ) { $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) ); $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) ); if ( isset( $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 ); $revQuery = Revision::getQueryInfo( [ 'page', 'user' ] ); return [ 'tables' => $revQuery['tables'], 'fields' => $revQuery['fields'], 'conds' => $conds, 'join_conds' => $revQuery['joins'] ]; } function getIndexField() { return 'rev_timestamp'; } }