Merge "Use quickUserCan instead of userCan for searches"
[lhc/web/wiklou.git] / includes / diff / DifferenceEngine.php
index f77a4eb..3aad389 100644 (file)
@@ -84,7 +84,7 @@ class DifferenceEngine extends ContextSource {
         */
        public $enableDebugComment = false;
 
-       /** @var bool  If true, line X is not displayed when X is 1, for example
+       /** @var bool If true, line X is not displayed when X is 1, for example
         *    to increase readability and conserve space with many small diffs.
         */
        protected $mReducedLineNumbers = false;
@@ -554,7 +554,7 @@ class DifferenceEngine extends ContextSource {
 
                        // NOTE: only needed for B/C: custom rendering of JS/CSS via hook
                        if ( $this->mNewPage->isCssJsSubpage() || $this->mNewPage->isCssOrJsPage() ) {
-                               // Stolen from Article::view --AG 2007-10-11
+                               // This needs to be synchronised with Article::showCssOrJsPage(), which sucks
                                // Give hooks a chance to customise the output
                                // @todo standardize this crap into one function
                                if ( ContentHandler::runLegacyHooks( 'ShowRawCssJs', array( $this->mNewContent, $this->mNewPage, $out ) ) ) {
@@ -562,8 +562,9 @@ class DifferenceEngine extends ContextSource {
                                        // use the content object's own rendering
                                        $cnt = $this->mNewRev->getContent();
                                        $po = $cnt ? $cnt->getParserOutput( $this->mNewRev->getTitle(), $this->mNewRev->getId() ) : null;
-                                       $txt = $po ? $po->getText() : '';
-                                       $out->addHTML( $txt );
+                                       if ( $po ) {
+                                               $out->addParserOutputContent( $po );
+                                       }
                                }
                        } elseif ( !wfRunHooks( 'ArticleContentViewCustom', array( $this->mNewContent, $this->mNewPage, $out ) ) ) {
                                // Handled by extension
@@ -970,8 +971,10 @@ class DifferenceEngine extends ContextSource {
                        $newRev = $this->mNewRev;
                }
 
-               $nEdits = $this->mNewPage->countRevisionsBetween( $oldRev, $newRev );
-               if ( $nEdits > 0 ) {
+               // Sanity: don't show the notice if too many rows must be scanned
+               // @TODO: show some special message for that case
+               $nEdits = $this->mNewPage->countRevisionsBetween( $oldRev, $newRev, 1000 );
+               if ( $nEdits > 0 && $nEdits <= 1000 ) {
                        $limit = 100; // use diff-multi-manyusers if too many users
                        $users = $this->mNewPage->getAuthorsBetween( $oldRev, $newRev, $limit );
                        $numUsers = count( $users );