Merge "rebuildLocalisationCache: Implement --lang option"
[lhc/web/wiklou.git] / includes / diff / DifferenceEngine.php
index 421bee9..8ee2b82 100644 (file)
@@ -223,33 +223,6 @@ class DifferenceEngine extends ContextSource {
                        throw new PermissionsError( 'read', $permErrors );
                }
 
-               # If external diffs are enabled both globally and for the user,
-               # we'll use the application/x-external-editor interface to call
-               # an external diff tool like kompare, kdiff3, etc.
-               if ( ExternalEdit::useExternalEngine( $this->getContext(), 'diff' ) ) {
-                       //TODO: come up with a good solution for non-text content here.
-                       //      at least, the content format needs to be passed to the client somehow.
-                       //      Currently, action=raw will just fail for non-text content.
-
-                       $urls = array(
-                               'File' => array( 'Extension' => 'wiki', 'URL' =>
-                                       # This should be mOldPage, but it may not be set, see below.
-                                       $this->mNewPage->getCanonicalURL( array(
-                                               'action' => 'raw', 'oldid' => $this->mOldid ) )
-                               ),
-                               'File2' => array( 'Extension' => 'wiki', 'URL' =>
-                                       $this->mNewPage->getCanonicalURL( array(
-                                               'action' => 'raw', 'oldid' => $this->mNewid ) )
-                               ),
-                       );
-
-                       $externalEditor = new ExternalEdit( $this->getContext(), $urls );
-                       $externalEditor->execute();
-
-                       wfProfileOut( __METHOD__ );
-                       return;
-               }
-
                $rollback = '';
                $undoLink = '';
 
@@ -267,6 +240,8 @@ class DifferenceEngine extends ContextSource {
                $deleted = $suppressed = false;
                $allowed = $this->mNewRev->userCan( Revision::DELETED_TEXT, $user );
 
+               $revisionTools = array();
+
                # mOldRev is false if the difference engine is called with a "vague" query for
                # a diff between a version V and its previous version V' AND the version V
                # is the first version of that article. In that case, V' does not exist.
@@ -277,11 +252,6 @@ class DifferenceEngine extends ContextSource {
                } else {
                        wfRunHooks( 'DiffViewHeader', array( $this, $this->mOldRev, $this->mNewRev ) );
 
-                       $sk = $this->getSkin();
-                       if ( method_exists( $sk, 'suppressQuickbar' ) ) {
-                               $sk->suppressQuickbar();
-                       }
-
                        if ( $this->mNewPage->equals( $this->mOldPage ) ) {
                                $out->setPageTitle( $this->msg( 'difference-title', $this->mNewPage->getPrefixedText() ) );
                                $samePage = true;
@@ -292,7 +262,6 @@ class DifferenceEngine extends ContextSource {
                                $samePage = false;
                        }
 
-                       $revisionTools = array();
                        if ( $samePage && $this->mNewPage->quickUserCan( 'edit', $user ) ) {
                                if ( $this->mNewRev->isCurrent() && $this->mNewPage->userCan( 'rollback', $user ) ) {
                                        $rollbackLink = Linker::generateRollback( $this->mNewRev, $this->getContext() );
@@ -303,7 +272,7 @@ class DifferenceEngine extends ContextSource {
                                }
                                if ( !$this->mOldRev->isDeleted( Revision::DELETED_TEXT ) && !$this->mNewRev->isDeleted( Revision::DELETED_TEXT ) ) {
                                        $undoLink = Html::element( 'a', array(
-                                                       'href' => $this->mNewPage->getLocalUrl( array(
+                                                       'href' => $this->mNewPage->getLocalURL( array(
                                                                'action' => 'edit',
                                                                'undoafter' => $this->mOldid,
                                                                'undo' => $this->mNewid ) ),
@@ -396,8 +365,9 @@ class DifferenceEngine extends ContextSource {
 
                if ( $this->mNewRev->isDeleted( Revision::DELETED_TEXT ) ) {
                        $deleted = true; // new revisions text is hidden
-                       if ( $this->mNewRev->isDeleted( Revision::DELETED_RESTRICTED ) )
+                       if ( $this->mNewRev->isDeleted( Revision::DELETED_RESTRICTED ) ) {
                                $suppressed = true; // also suppressed
+                       }
                }
 
                # If the diff cannot be shown due to a deleted revision, then output
@@ -413,7 +383,7 @@ class DifferenceEngine extends ContextSource {
                                        array( $msg ) );
                        } else {
                                # Give explanation and add a link to view the diff...
-                               $link = $this->getTitle()->getFullUrl( $this->getRequest()->appendQueryValue( 'unhide', '1', true ) );
+                               $link = $this->getTitle()->getFullURL( $this->getRequest()->appendQueryValue( 'unhide', '1', true ) );
                                $msg = $suppressed ? 'rev-suppressed-unhide-diff' : 'rev-deleted-unhide-diff';
                                $out->wrapWikiMsg( "<div id='mw-$msg' class='mw-warning plainlinks'>\n$1\n</div>\n", array( $msg, $link ) );
                        }
@@ -459,11 +429,11 @@ class DifferenceEngine extends ContextSource {
                                        $change = RecentChange::newFromConds(
                                                array(
                                                // Redundant user,timestamp condition so we can use the existing index
-                                                       'rc_user_text'  => $this->mNewRev->getRawUserText(),
-                                                       'rc_timestamp'  => $db->timestamp( $this->mNewRev->getTimestamp() ),
+                                                       'rc_user_text' => $this->mNewRev->getRawUserText(),
+                                                       'rc_timestamp' => $db->timestamp( $this->mNewRev->getTimestamp() ),
                                                        'rc_this_oldid' => $this->mNewid,
                                                        'rc_last_oldid' => $this->mOldid,
-                                                       'rc_patrolled'  => 0
+                                                       'rc_patrolled' => 0
                                                ),
                                                __METHOD__
                                        );
@@ -544,9 +514,9 @@ class DifferenceEngine extends ContextSource {
                                        $txt = $po ? $po->getText() : '';
                                        $out->addHTML( $txt );
                                }
-                       } elseif( !wfRunHooks( 'ArticleContentViewCustom', array( $this->mNewContent, $this->mNewPage, $out ) ) ) {
+                       } elseif ( !wfRunHooks( 'ArticleContentViewCustom', array( $this->mNewContent, $this->mNewPage, $out ) ) ) {
                                // Handled by extension
-                       } elseif( !ContentHandler::runLegacyHooks( 'ArticleViewCustom', array( $this->mNewContent, $this->mNewPage, $out ) ) ) {
+                       } elseif ( !ContentHandler::runLegacyHooks( 'ArticleViewCustom', array( $this->mNewContent, $this->mNewPage, $out ) ) ) {
                                // NOTE: deprecated hook, B/C only
                                // Handled by extension
                        } else {
@@ -575,7 +545,7 @@ class DifferenceEngine extends ContextSource {
                                                # Show categories etc.
                                                $out->addParserOutputNoText( $parserOutput );
                                        }
-                               } else if ( $parserOutput ) {
+                               } elseif ( $parserOutput ) {
                                        $out->addParserOutput( $parserOutput );
                                }
                        }
@@ -892,7 +862,9 @@ class DifferenceEngine extends ContextSource {
        }
 
        function localiseLineNumbersCb( $matches ) {
-               if ( $matches[1] === '1' && $this->mReducedLineNumbers ) return '';
+               if ( $matches[1] === '1' && $this->mReducedLineNumbers ) {
+                       return '';
+               }
                return $this->msg( 'lineno' )->numParams( $matches[1] )->escaped();
        }