From 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 12 Aug 2013 09:28:15 +0200 Subject: Update to MediaWiki 1.21.1 --- includes/specials/SpecialMergeHistory.php | 53 +++++++++++++++++++------------ 1 file changed, 32 insertions(+), 21 deletions(-) (limited to 'includes/specials/SpecialMergeHistory.php') diff --git a/includes/specials/SpecialMergeHistory.php b/includes/specials/SpecialMergeHistory.php index 1f057499..1476e156 100644 --- a/includes/specials/SpecialMergeHistory.php +++ b/includes/specials/SpecialMergeHistory.php @@ -141,7 +141,7 @@ class SpecialMergeHistory extends SpecialPage { '
' . Xml::element( 'legend', array(), $this->msg( 'mergehistory-box' )->text() ) . - Html::hidden( 'title', $this->getTitle()->getPrefixedDbKey() ) . + Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . Html::hidden( 'submitted', '1' ) . Html::hidden( 'mergepoint', $this->mTimestamp ) . Xml::openElement( 'table' ) . @@ -373,26 +373,33 @@ class SpecialMergeHistory extends SpecialPage { $destTitle->getPrefixedText() )->inContentLanguage()->text(); } - $mwRedir = MagicWord::get( 'redirect' ); - $redirectText = $mwRedir->getSynonym( 0 ) . ' [[' . $destTitle->getPrefixedText() . "]]\n"; - $redirectPage = WikiPage::factory( $targetTitle ); - $redirectRevision = new Revision( array( - 'page' => $this->mTargetID, - 'comment' => $comment, - 'text' => $redirectText ) ); - $redirectRevision->insertOn( $dbw ); - $redirectPage->updateRevisionOn( $dbw, $redirectRevision ); - - # Now, we record the link from the redirect to the new title. - # It should have no other outgoing links... - $dbw->delete( 'pagelinks', array( 'pl_from' => $this->mDestID ), __METHOD__ ); - $dbw->insert( 'pagelinks', - array( - 'pl_from' => $this->mDestID, - 'pl_namespace' => $destTitle->getNamespace(), - 'pl_title' => $destTitle->getDBkey() ), - __METHOD__ - ); + + $contentHandler = ContentHandler::getForTitle( $targetTitle ); + $redirectContent = $contentHandler->makeRedirectContent( $destTitle ); + + if ( $redirectContent ) { + $redirectPage = WikiPage::factory( $targetTitle ); + $redirectRevision = new Revision( array( + 'title' => $targetTitle, + 'page' => $this->mTargetID, + 'comment' => $comment, + 'content' => $redirectContent ) ); + $redirectRevision->insertOn( $dbw ); + $redirectPage->updateRevisionOn( $dbw, $redirectRevision ); + + # Now, we record the link from the redirect to the new title. + # It should have no other outgoing links... + $dbw->delete( 'pagelinks', array( 'pl_from' => $this->mDestID ), __METHOD__ ); + $dbw->insert( 'pagelinks', + array( + 'pl_from' => $this->mDestID, + 'pl_namespace' => $destTitle->getNamespace(), + 'pl_title' => $destTitle->getDBkey() ), + __METHOD__ + ); + } else { + // would be nice to show a warning if we couldn't create a redirect + } } else { $targetTitle->invalidateCache(); // update histories } @@ -416,6 +423,10 @@ class SpecialMergeHistory extends SpecialPage { return true; } + + protected function getGroupName() { + return 'pagetools'; + } } class MergeHistoryPager extends ReverseChronologicalPager { -- cgit v1.2.2