summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialMergeHistory.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialMergeHistory.php')
-rw-r--r--includes/specials/SpecialMergeHistory.php53
1 files changed, 32 insertions, 21 deletions
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 {
'<fieldset>' .
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 {