X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialMergeHistory.php;h=b916c1fc7860bfe2ed35ade8733dd90dcad0b6a9;hb=f47b7d6afc77ad8b08ba803289852f7c11ea1905;hp=0cefb3892066704bba7c3197c12ca1223237b342;hpb=ffacfb7be40454c98ae73f6b92bf9836c68ff53c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialMergeHistory.php b/includes/specials/SpecialMergeHistory.php index 0cefb38920..b916c1fc78 100644 --- a/includes/specials/SpecialMergeHistory.php +++ b/includes/specials/SpecialMergeHistory.php @@ -126,7 +126,7 @@ class SpecialMergeHistory extends SpecialPage { return; } - $errors = array(); + $errors = []; if ( !$this->mTargetObj instanceof Title ) { $errors[] = $this->msg( 'mergehistory-invalid-source' )->parseAsBlock(); } elseif ( !$this->mTargetObj->exists() ) { @@ -160,11 +160,11 @@ class SpecialMergeHistory extends SpecialPage { $out->addWikiMsg( 'mergehistory-header' ); $out->addHTML( - Xml::openElement( 'form', array( + Xml::openElement( 'form', [ 'method' => 'get', - 'action' => wfScript() ) ) . + 'action' => wfScript() ] ) . '
' . - Xml::element( 'legend', array(), + Xml::element( 'legend', [], $this->msg( 'mergehistory-box' )->text() ) . Html::hidden( 'title', $this->getPageTitle()->getPrefixedDBkey() ) . Html::hidden( 'submitted', '1' ) . @@ -172,10 +172,10 @@ class SpecialMergeHistory extends SpecialPage { Xml::openElement( 'table' ) . ' ' . Xml::label( $this->msg( 'mergehistory-from' )->text(), 'target' ) . ' - ' . Xml::input( 'target', 30, $this->mTarget, array( 'id' => 'target' ) ) . ' + ' . Xml::input( 'target', 30, $this->mTarget, [ 'id' => 'target' ] ) . ' ' . Xml::label( $this->msg( 'mergehistory-into' )->text(), 'dest' ) . ' - ' . Xml::input( 'dest', 30, $this->mDest, array( 'id' => 'dest' ) ) . ' + ' . Xml::input( 'dest', 30, $this->mDest, [ 'id' => 'dest' ] ) . ' ' . Xml::submitButton( $this->msg( 'mergehistory-go' )->text() ) . '' . @@ -192,21 +192,21 @@ class SpecialMergeHistory extends SpecialPage { # 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 ); @@ -217,13 +217,13 @@ class SpecialMergeHistory extends SpecialPage { 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' ] ) . ' ' . Xml::label( $this->msg( 'mergehistory-reason' )->text(), 'wpComment' ) . ' ' . - Xml::input( 'wpComment', 50, $this->mComment, array( 'id' => 'wpComment' ) ) . + Xml::input( 'wpComment', 50, $this->mComment, [ 'id' => 'wpComment' ] ) . ' @@ -231,7 +231,7 @@ class SpecialMergeHistory extends SpecialPage { ' . Xml::submitButton( $this->msg( 'mergehistory-submit' )->text(), - array( 'name' => 'merge', 'id' => 'mw-merge-submit' ) + [ 'name' => 'merge', 'id' => 'mw-merge-submit' ] ) . ' ' . @@ -288,8 +288,8 @@ class SpecialMergeHistory extends SpecialPage { $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 = '' . $pageLink . ''; @@ -302,11 +302,11 @@ class SpecialMergeHistory extends SpecialPage { $last = Linker::linkKnown( $rev->getTitle(), $this->msg( 'last' )->escaped(), - array(), - array( + [], + [ 'diff' => $row->rev_id, 'oldid' => $this->prevId[$row->rev_id] - ) + ] ); } @@ -318,7 +318,7 @@ class SpecialMergeHistory extends SpecialPage { } $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() ); } @@ -362,8 +362,8 @@ class SpecialMergeHistory extends SpecialPage { $targetLink = Linker::link( $targetTitle, null, - array(), - array( 'redirect' => 'no' ) + [], + [ 'redirect' => 'no' ] ); $this->getOutput()->addWikiMsg( $this->msg( 'mergehistory-done' ) @@ -379,78 +379,3 @@ class SpecialMergeHistory extends SpecialPage { 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'; - } -}