diff options
Diffstat (limited to 'includes/specials/SpecialComparePages.php')
-rw-r--r-- | includes/specials/SpecialComparePages.php | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/includes/specials/SpecialComparePages.php b/includes/specials/SpecialComparePages.php index 9e3c52b9..c3bd3fec 100644 --- a/includes/specials/SpecialComparePages.php +++ b/includes/specials/SpecialComparePages.php @@ -106,28 +106,33 @@ class SpecialComparePages extends SpecialPage { $form->trySubmit(); } - public static function showDiff( $data, HTMLForm $form ){ + public static function showDiff( $data, HTMLForm $form ) { $rev1 = self::revOrTitle( $data['Revision1'], $data['Page1'] ); $rev2 = self::revOrTitle( $data['Revision2'], $data['Page2'] ); if( $rev1 && $rev2 ) { - $de = new DifferenceEngine( $form->getContext(), - $rev1, - $rev2, - null, // rcid - ( $data['Action'] == 'purge' ), - ( $data['Unhide'] == '1' ) - ); - $de->showDiffPage( true ); + $revision = Revision::newFromId( $rev1 ); + + if ( $revision ) { // NOTE: $rev1 was already checked, should exist. + $contentHandler = $revision->getContentHandler(); + $de = $contentHandler->createDifferenceEngine( $form->getContext(), + $rev1, + $rev2, + null, // rcid + ( $data['Action'] == 'purge' ), + ( $data['Unhide'] == '1' ) + ); + $de->showDiffPage( true ); + } } } public static function revOrTitle( $revision, $title ) { - if( $revision ){ + if( $revision ) { return $revision; } elseif( $title ) { $title = Title::newFromText( $title ); - if( $title instanceof Title ){ + if( $title instanceof Title ) { return $title->getLatestRevID(); } } @@ -158,4 +163,8 @@ class SpecialComparePages extends SpecialPage { } return true; } + + protected function getGroupName() { + return 'pagetools'; + } } |