diff options
Diffstat (limited to 'includes/specials/SpecialComparePages.php')
-rw-r--r-- | includes/specials/SpecialComparePages.php | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/includes/specials/SpecialComparePages.php b/includes/specials/SpecialComparePages.php index 9e3c52b9..fc6b0c58 100644 --- a/includes/specials/SpecialComparePages.php +++ b/includes/specials/SpecialComparePages.php @@ -106,31 +106,37 @@ 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 ); + if ( $rev1 && $rev2 ) { + $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 ) { + } elseif ( $title ) { $title = Title::newFromText( $title ); - if( $title instanceof Title ){ + if ( $title instanceof Title ) { return $title->getLatestRevID(); } } + return null; } @@ -145,6 +151,7 @@ class SpecialComparePages extends SpecialPage { if ( !$title->exists() ) { return $this->msg( 'compare-title-not-exists' )->parseAsBlock(); } + return true; } @@ -156,6 +163,11 @@ class SpecialComparePages extends SpecialPage { if ( $revision === null ) { return $this->msg( 'compare-revision-not-exists' )->parseAsBlock(); } + return true; } + + protected function getGroupName() { + return 'pagetools'; + } } |