Index: trunk/phase3/includes/diff/DifferenceEngine.php |
— | — | @@ -607,26 +607,31 @@ |
608 | 608 | /** |
609 | 609 | * Get the diff table body, without header |
610 | 610 | * |
611 | | - * @return mixed |
| 611 | + * @return mixed (string/false) |
612 | 612 | */ |
613 | | - function getDiffBody() { |
| 613 | + public function getDiffBody() { |
614 | 614 | global $wgMemc; |
615 | 615 | wfProfileIn( __METHOD__ ); |
616 | 616 | $this->mCacheHit = true; |
617 | 617 | // Check if the diff should be hidden from this user |
618 | | - if ( !$this->loadRevisionData() ) |
| 618 | + if ( !$this->loadRevisionData() ) { |
| 619 | + return false; |
| 620 | + } elseif ( $this->mOldRev && !$this->mOldRev->userCan( Revision::DELETED_TEXT ) ) { |
| 621 | + return false; |
| 622 | + } elseif ( $this->mNewRev && !$this->mNewRev->userCan( Revision::DELETED_TEXT ) ) { |
| 623 | + return false; |
| 624 | + } |
| 625 | + // Short-circuit |
| 626 | + if ( $this->mOldRev && $this->mNewRev |
| 627 | + && $this->mOldRev->getID() == $this->mNewRev->getID() ) |
| 628 | + { |
619 | 629 | return ''; |
620 | | - if ( $this->mOldRev && !$this->mOldRev->userCan(Revision::DELETED_TEXT) ) { |
621 | | - return ''; |
622 | | - } else if ( $this->mNewRev && !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) { |
623 | | - return ''; |
624 | | - } else if ( $this->mOldRev && $this->mNewRev && $this->mOldRev->getID() == $this->mNewRev->getID() ) { |
625 | | - return ''; |
626 | 630 | } |
627 | 631 | // Cacheable? |
628 | 632 | $key = false; |
629 | 633 | if ( $this->mOldid && $this->mNewid ) { |
630 | | - $key = wfMemcKey( 'diff', 'version', MW_DIFF_VERSION, 'oldid', $this->mOldid, 'newid', $this->mNewid ); |
| 634 | + $key = wfMemcKey( 'diff', 'version', MW_DIFF_VERSION, |
| 635 | + 'oldid', $this->mOldid, 'newid', $this->mNewid ); |
631 | 636 | // Try cache |
632 | 637 | if ( !$this->mRefreshCache ) { |
633 | 638 | $difftext = $wgMemc->get( $key ); |
— | — | @@ -652,7 +657,7 @@ |
653 | 658 | // Save to cache for 7 days |
654 | 659 | if ( !wfRunHooks( 'AbortDiffCache', array( &$this ) ) ) { |
655 | 660 | wfIncrStats( 'diff_uncacheable' ); |
656 | | - } else if ( $key !== false && $difftext !== false ) { |
| 661 | + } elseif ( $key !== false && $difftext !== false ) { |
657 | 662 | wfIncrStats( 'diff_cache_miss' ); |
658 | 663 | $wgMemc->set( $key, $difftext, 7*86400 ); |
659 | 664 | } else { |