Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewList.php |
— | — | @@ -161,7 +161,7 @@ |
162 | 162 | 'af_timestamp', |
163 | 163 | 'af_user_text', |
164 | 164 | 'af_user', |
165 | | - 'af_actions' |
| 165 | + 'af_actions', |
166 | 166 | ), |
167 | 167 | 'conds' => $this->mConds, |
168 | 168 | ); |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -714,13 +714,15 @@ |
715 | 715 | /** |
716 | 716 | * @param Article $article |
717 | 717 | * @param User $user |
| 718 | + * |
| 719 | + * Now a wrapper around Article::tryParserCache() |
718 | 720 | * |
719 | 721 | * @return bool True if successful, else false. |
720 | 722 | */ |
721 | 723 | public function tryParserCache( &$article ) { |
722 | | - $parserCache = ParserCache::singleton(); |
723 | | - $parserOutput = $parserCache->get( $article, $this->parserOptions() ); |
724 | | - if ( $parserOutput !== false ) { |
| 724 | + $parserOutput = $article->tryParserCache( $this->parserOptions() ); |
| 725 | + |
| 726 | + if ($parserOutput !== false) { |
725 | 727 | $this->addParserOutput( $parserOutput ); |
726 | 728 | return true; |
727 | 729 | } else { |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -3675,6 +3675,19 @@ |
3676 | 3676 | * @param $cache Boolean |
3677 | 3677 | */ |
3678 | 3678 | public function outputWikiText( $text, $cache = true ) { |
| 3679 | + global $wgOut; |
| 3680 | + |
| 3681 | + $parserOutput = $this->outputFromWikitext( $text, $cache ); |
| 3682 | + |
| 3683 | + $wgOut->addParserOutput( $parserOutput ); |
| 3684 | + } |
| 3685 | + |
| 3686 | + /** |
| 3687 | + * This does all the heavy lifting for outputWikitext, except it returns the parser |
| 3688 | + * output instead of sending it straight to $wgOut. Makes things nice and simple for, |
| 3689 | + * say, embedding thread pages within a discussion system (LiquidThreads) |
| 3690 | + */ |
| 3691 | + public function outputFromWikitext( $text, $cache = true ) { |
3679 | 3692 | global $wgParser, $wgOut, $wgEnableParserCache, $wgUseFileCache; |
3680 | 3693 | |
3681 | 3694 | $popts = $wgOut->parserOptions(); |
— | — | @@ -3737,8 +3750,8 @@ |
3738 | 3751 | $u->doUpdate(); |
3739 | 3752 | } |
3740 | 3753 | } |
3741 | | - |
3742 | | - $wgOut->addParserOutput( $parserOutput ); |
| 3754 | + |
| 3755 | + return $parserOutput; |
3743 | 3756 | } |
3744 | 3757 | |
3745 | 3758 | /** |
— | — | @@ -3797,4 +3810,46 @@ |
3798 | 3811 | ); |
3799 | 3812 | } |
3800 | 3813 | } |
| 3814 | + |
| 3815 | + function tryParserCache( $parserOptions ) { |
| 3816 | + $parserCache = ParserCache::singleton(); |
| 3817 | + $parserOutput = $parserCache->get( $this, $parserOptions ); |
| 3818 | + if ( $parserOutput !== false ) { |
| 3819 | + return $parserOutput; |
| 3820 | + } else { |
| 3821 | + return false; |
| 3822 | + } |
| 3823 | + } |
| 3824 | + |
| 3825 | + /** Lightweight method to get the parser output for a page, checking the parser cache |
| 3826 | + * and so on. Doesn't consider most of the stuff that Article::view is forced to |
| 3827 | + * consider, so it's not appropriate to use there. */ |
| 3828 | + function getParserOutput( $oldid = null ) { |
| 3829 | + global $wgEnableParserCache, $wgUser, $wgOut; |
| 3830 | + |
| 3831 | + // Should the parser cache be used? |
| 3832 | + $pcache = $wgEnableParserCache && |
| 3833 | + intval( $wgUser->getOption( 'stubthreshold' ) ) == 0 && |
| 3834 | + $this->exists() && |
| 3835 | + $oldid === null; |
| 3836 | + |
| 3837 | + wfDebug( __METHOD__.': using parser cache: ' . ( $pcache ? 'yes' : 'no' ) . "\n" ); |
| 3838 | + if ( $wgUser->getOption( 'stubthreshold' ) ) { |
| 3839 | + wfIncrStats( 'pcache_miss_stub' ); |
| 3840 | + } |
| 3841 | + |
| 3842 | + $parserOutput = false; |
| 3843 | + if ( $pcache ) { |
| 3844 | + $parserOutput = $this->tryParserCache( $wgOut->parserOptions() ); |
| 3845 | + } |
| 3846 | + |
| 3847 | + if ( $parserOutput === false ) { |
| 3848 | + // Cache miss; parse and output it. |
| 3849 | + $rev = Revision::newFromTitle( $this->getTitle(), $oldid ); |
| 3850 | + |
| 3851 | + return $this->outputFromWikitext( $rev->getText(), $pcache ); |
| 3852 | + } else { |
| 3853 | + return $parserOutput; |
| 3854 | + } |
| 3855 | + } |
3801 | 3856 | } |