Merge "Support multi-content diffs on Special:Undelete"
[lhc/web/wiklou.git] / includes / specials / SpecialUndelete.php
index e4e513e..6a01b0c 100644 (file)
@@ -347,7 +347,13 @@ class SpecialUndelete extends SpecialPage {
                                );
                        }
                        $revs = $this->msg( 'undeleterevisions' )->numParams( $row->count )->parse();
-                       $out->addHTML( "<li class='undeleteResult'>{$item} ({$revs})</li>\n" );
+                       $out->addHTML(
+                               Html::rawElement(
+                                       'li',
+                                       [ 'class' => 'undeleteResult' ],
+                                       "{$item} ({$revs})"
+                               )
+                       );
                }
                $result->free();
                $out->addHTML( "</ul>\n" );
@@ -443,8 +449,12 @@ class SpecialUndelete extends SpecialPage {
                        }
                }
 
-               $out->addHTML( $this->msg( 'undelete-revision' )->rawParams( $link )->params(
-                       $time )->rawParams( $userLink )->params( $d, $t )->parse() . '</div>' );
+               $out->addWikiMsg(
+                       'undelete-revision',
+                       Message::rawParam( $link ), $time,
+                       Message::rawParam( $userLink ), $d, $t
+               );
+               $out->addHtml( '</div>' );
 
                if ( !Hooks::run( 'UndeleteShowRevision', [ $this->mTargetObj, $rev ] ) ) {
                        return;
@@ -545,15 +555,9 @@ class SpecialUndelete extends SpecialPage {
                $diffContext->setWikiPage( WikiPage::factory( $currentRev->getTitle() ) );
 
                $diffEngine = $currentRev->getContentHandler()->createDifferenceEngine( $diffContext );
+               $diffEngine->setRevisions( $previousRev->getRevisionRecord(), $currentRev->getRevisionRecord() );
                $diffEngine->showDiffStyle();
-
-               $formattedDiff = $diffEngine->generateContentDiffBody(
-                       $previousRev->getContent( Revision::FOR_THIS_USER, $this->getUser() ),
-                       $currentRev->getContent( Revision::FOR_THIS_USER, $this->getUser() )
-               );
-
-               $formattedDiff = $diffEngine->addHeader(
-                       $formattedDiff,
+               $formattedDiff = $diffEngine->getDiff(
                        $this->diffHeader( $previousRev, 'o' ),
                        $this->diffHeader( $currentRev, 'n' )
                );
@@ -1169,7 +1173,7 @@ class SpecialUndelete extends SpecialPage {
                        }
 
                        $link = $this->getLinkRenderer()->makeKnownLink( $this->mTargetObj );
-                       $out->addHTML( $this->msg( 'undeletedpage' )->rawParams( $link )->parse() );
+                       $out->addWikiMsg( 'undeletedpage', Message::rawParam( $link ) );
                } else {
                        $out->setPageTitle( $this->msg( 'undelete-error' ) );
                }
@@ -1177,7 +1181,9 @@ class SpecialUndelete extends SpecialPage {
                // Show revision undeletion warnings and errors
                $status = $archive->getRevisionStatus();
                if ( $status && !$status->isGood() ) {
-                       $out->addWikiText( '<div class="error" id="mw-error-cannotundelete">' .
+                       $out->wrapWikiTextAsInterface(
+                               'error',
+                               '<div id="mw-error-cannotundelete">' .
                                $status->getWikiText(
                                        'cannotundelete',
                                        'cannotundelete'
@@ -1188,11 +1194,12 @@ class SpecialUndelete extends SpecialPage {
                // Show file undeletion warnings and errors
                $status = $archive->getFileStatus();
                if ( $status && !$status->isGood() ) {
-                       $out->addWikiText( '<div class="error">' .
+                       $out->wrapWikiTextAsInterface(
+                               'error',
                                $status->getWikiText(
                                        'undelete-error-short',
                                        'undelete-error-long'
-                               ) . '</div>'
+                               )
                        );
                }
        }