return;
}
- $errors = array();
+ $errors = [];
if ( !$this->mTargetObj instanceof Title ) {
$errors[] = $this->msg( 'mergehistory-invalid-source' )->parseAsBlock();
} elseif ( !$this->mTargetObj->exists() ) {
$out->addWikiMsg( 'mergehistory-header' );
$out->addHTML(
- Xml::openElement( 'form', array(
+ Xml::openElement( 'form', [
'method' => 'get',
- 'action' => wfScript() ) ) .
+ 'action' => wfScript() ] ) .
'<fieldset>' .
- Xml::element( 'legend', array(),
+ Xml::element( 'legend', [],
$this->msg( 'mergehistory-box' )->text() ) .
Html::hidden( 'title', $this->getPageTitle()->getPrefixedDBkey() ) .
Html::hidden( 'submitted', '1' ) .
Xml::openElement( 'table' ) .
'<tr>
<td>' . Xml::label( $this->msg( 'mergehistory-from' )->text(), 'target' ) . '</td>
- <td>' . Xml::input( 'target', 30, $this->mTarget, array( 'id' => 'target' ) ) . '</td>
+ <td>' . Xml::input( 'target', 30, $this->mTarget, [ 'id' => 'target' ] ) . '</td>
</tr><tr>
<td>' . Xml::label( $this->msg( 'mergehistory-into' )->text(), 'dest' ) . '</td>
- <td>' . Xml::input( 'dest', 30, $this->mDest, array( 'id' => 'dest' ) ) . '</td>
+ <td>' . Xml::input( 'dest', 30, $this->mDest, [ 'id' => 'dest' ] ) . '</td>
</tr><tr><td>' .
Xml::submitButton( $this->msg( 'mergehistory-go' )->text() ) .
'</td></tr>' .
# List all stored revisions
$revisions = new MergeHistoryPager(
- $this, array(), $this->mTargetObj, $this->mDestObj
+ $this, [], $this->mTargetObj, $this->mDestObj
);
$haveRevisions = $revisions && $revisions->getNumRows() > 0;
$out = $this->getOutput();
$titleObj = $this->getPageTitle();
- $action = $titleObj->getLocalURL( array( 'action' => 'submit' ) );
+ $action = $titleObj->getLocalURL( [ 'action' => 'submit' ] );
# Start the form here
$top = Xml::openElement(
'form',
- array(
+ [
'method' => 'post',
'action' => $action,
'id' => 'merge'
- )
+ ]
);
$out->addHTML( $top );
Xml::openElement( 'fieldset' ) .
$this->msg( 'mergehistory-merge', $this->mTargetObj->getPrefixedText(),
$this->mDestObj->getPrefixedText() )->parse() .
- Xml::openElement( 'table', array( 'id' => 'mw-mergehistory-table' ) ) .
+ Xml::openElement( 'table', [ 'id' => 'mw-mergehistory-table' ] ) .
'<tr>
<td class="mw-label">' .
Xml::label( $this->msg( 'mergehistory-reason' )->text(), 'wpComment' ) .
'</td>
<td class="mw-input">' .
- Xml::input( 'wpComment', 50, $this->mComment, array( 'id' => 'wpComment' ) ) .
+ Xml::input( 'wpComment', 50, $this->mComment, [ 'id' => 'wpComment' ] ) .
'</td>
</tr>
<tr>
<td class="mw-submit">' .
Xml::submitButton(
$this->msg( 'mergehistory-submit' )->text(),
- array( 'name' => 'merge', 'id' => 'mw-merge-submit' )
+ [ 'name' => 'merge', 'id' => 'mw-merge-submit' ]
) .
'</td>
</tr>' .
$pageLink = Linker::linkKnown(
$rev->getTitle(),
htmlspecialchars( $this->getLanguage()->userTimeAndDate( $ts, $user ) ),
- array(),
- array( 'oldid' => $rev->getId() )
+ [],
+ [ 'oldid' => $rev->getId() ]
);
if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
$pageLink = '<span class="history-deleted">' . $pageLink . '</span>';
$last = Linker::linkKnown(
$rev->getTitle(),
$this->msg( 'last' )->escaped(),
- array(),
- array(
+ [],
+ [
'diff' => $row->rev_id,
'oldid' => $this->prevId[$row->rev_id]
- )
+ ]
);
}
}
$comment = Linker::revComment( $rev );
- return Html::rawElement( 'li', array(),
+ return Html::rawElement( 'li', [],
$this->msg( 'mergehistory-revisionrow' )
->rawParams( $checkBox, $last, $pageLink, $userLink, $stxt, $comment )->escaped() );
}
$targetLink = Linker::link(
$targetTitle,
null,
- array(),
- array( 'redirect' => 'no' )
+ [],
+ [ 'redirect' => 'no' ]
);
$this->getOutput()->addWikiMsg( $this->msg( 'mergehistory-done' )
return 'pagetools';
}
}
-
-class MergeHistoryPager extends ReverseChronologicalPager {
- /** @var SpecialMergeHistory */
- public $mForm;
-
- /** @var array */
- public $mConds;
-
- function __construct( SpecialMergeHistory $form, $conds, Title $source, Title $dest ) {
- $this->mForm = $form;
- $this->mConds = $conds;
- $this->title = $source;
- $this->articleID = $source->getArticleID();
-
- $dbr = wfGetDB( DB_SLAVE );
- $maxtimestamp = $dbr->selectField(
- 'revision',
- 'MIN(rev_timestamp)',
- array( '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 = array();
- 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 array(
- 'tables' => array( 'revision', 'page', 'user' ),
- 'fields' => array_merge( Revision::selectFields(), Revision::selectUserFields() ),
- 'conds' => $conds,
- 'join_conds' => array(
- 'page' => Revision::pageJoinCond(),
- 'user' => Revision::userJoinCond() )
- );
- }
-
- function getIndexField() {
- return 'rev_timestamp';
- }
-}