X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdiff%2FDifferenceEngine.php;h=d6cf69494c2e9b785a56c286d811a918bb18568d;hb=55cd620157d884af855459f1f7903b0427c992ce;hp=6e74f2c8d49cc300bfddabbc221022c664851d71;hpb=075b90235e86de663c000db2c90253509bb97375;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 6e74f2c8d4..d6cf69494c 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -88,7 +88,7 @@ class DifferenceEngine extends ContextSource { */ protected $mReducedLineNumbers = false; - /** @var string Link to action=markpatrolled */ + /** @var string Link to action=markpatrolled */ protected $mMarkPatrolledLink = null; /** @var bool Show rev_deleted content if allowed */ @@ -381,7 +381,7 @@ class DifferenceEngine extends ContextSource { $rdel = $this->revisionDeleteLink( $this->mNewRev ); # Allow extensions to define their own revision tools - wfRunHooks( 'DiffRevisionTools', array( $this->mNewRev, &$revisionTools ) ); + wfRunHooks( 'DiffRevisionTools', array( $this->mNewRev, &$revisionTools, $this->mOldRev ) ); $formattedRevisionTools = array(); // Put each one in parentheses (poor man's button) foreach ( $revisionTools as $tool ) { @@ -580,19 +580,8 @@ class DifferenceEngine extends ContextSource { $parserOutput = $this->getParserOutput( $wikiPage, $this->mNewRev ); - # Also try to load it as a redirect - $rt = $this->mNewContent ? $this->mNewContent->getRedirectTarget() : null; - - if ( $rt ) { - $article = Article::newFromTitle( $this->mNewPage, $this->getContext() ); - $out->addHTML( $article->viewRedirect( $rt ) ); - - # WikiPage::getParserOutput() should not return false, but just in case - if ( $parserOutput ) { - # Show categories etc. - $out->addParserOutputNoText( $parserOutput ); - } - } elseif ( $parserOutput ) { + # WikiPage::getParserOutput() should not return false, but just in case + if ( $parserOutput ) { $out->addParserOutput( $parserOutput ); } } @@ -974,7 +963,12 @@ class DifferenceEngine extends ContextSource { $nEdits = $this->mNewPage->countRevisionsBetween( $oldRev, $newRev ); if ( $nEdits > 0 ) { $limit = 100; // use diff-multi-manyusers if too many users - $numUsers = $this->mNewPage->countAuthorsBetween( $oldRev, $newRev, $limit ); + $users = $this->mNewPage->getAuthorsBetween( $oldRev, $newRev, $limit ); + $numUsers = count( $users ); + + if ( $numUsers == 1 && $users[0] == $newRev->getRawUserText() ) { + $numUsers = 0; // special case to say "by the same user" instead of "by one other user" + } return self::intermediateEditsMsg( $nEdits, $numUsers, $limit ); } @@ -990,11 +984,13 @@ class DifferenceEngine extends ContextSource { * @return string */ public static function intermediateEditsMsg( $numEdits, $numUsers, $limit ) { - if ( $numUsers > $limit ) { + if ( $numUsers === 0 ) { + $msg = 'diff-multi-sameuser'; + } elseif ( $numUsers > $limit ) { $msg = 'diff-multi-manyusers'; $numUsers = $limit; } else { - $msg = 'diff-multi'; + $msg = 'diff-multi-otherusers'; } return wfMessage( $msg )->numParams( $numEdits, $numUsers )->parse();