r52144 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52143‎ | r52144 | r52145 >
Date:20:59, 18 June 2009
Author:werdna
Status:ok
Tags:
Comment:
Revert half-done refactoring committed in r52143
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -3674,19 +3674,6 @@
36753675 * @param $cache Boolean
36763676 */
36773677 public function outputWikiText( $text, $cache = true ) {
3678 - global $wgOut;
3679 -
3680 - $parserOutput = $this->outputFromWikitext( $text, $cache );
3681 -
3682 - $wgOut->addParserOutput( $parserOutput );
3683 - }
3684 -
3685 - /**
3686 - * This does all the heavy lifting for outputWikitext, except it returns the parser
3687 - * output instead of sending it straight to $wgOut. Makes things nice and simple for,
3688 - * say, embedding thread pages within a discussion system (LiquidThreads)
3689 - */
3690 - public function outputFromWikitext( $text, $cache = true ) {
36913678 global $wgParser, $wgOut, $wgEnableParserCache, $wgUseFileCache;
36923679
36933680 $popts = $wgOut->parserOptions();
@@ -3749,8 +3736,8 @@
37503737 $u->doUpdate();
37513738 }
37523739 }
3753 -
3754 - return $parserOutput;
 3740+
 3741+ $wgOut->addParserOutput( $parserOutput );
37553742 }
37563743
37573744 /**
@@ -3809,51 +3796,4 @@
38103797 );
38113798 }
38123799 }
3813 -
3814 - function tryParserCache( $parserOptions ) {
3815 - $parserCache = ParserCache::singleton();
3816 - $parserOutput = $parserCache->get( $article, $parserOptions );
3817 - if ( $parserOutput !== false ) {
3818 - return $parserOutput;
3819 - } else {
3820 - return false;
3821 - }
3822 - }
3823 -
3824 - function getParserOutput( $oldid = null ) {
3825 - global $wgEnableParserCache, $wgUser, $wgOut;
3826 -
3827 - // Should the parser cache be used?
3828 - $pcache = $wgEnableParserCache &&
3829 - intval( $wgUser->getOption( 'stubthreshold' ) ) == 0 &&
3830 - $this->exists() &&
3831 - $oldid === null;
3832 -
3833 - wfDebug( __METHOD__.': using parser cache: ' . ( $pcache ? 'yes' : 'no' ) . "\n" );
3834 - if ( $wgUser->getOption( 'stubthreshold' ) ) {
3835 - wfIncrStats( 'pcache_miss_stub' );
3836 - }
3837 -
3838 - $parserOutput = false;
3839 - if ( $pcache ) {
3840 - $parserOutput = $this->tryParserCache( $wgOut->parserOptions() );
3841 - }
3842 -
3843 - if ( $parserOutput === false ) {
3844 - // Cache miss; parse and output it.
3845 - $rev = Revision::newFromTitle( $post->getTitle(), $oldid );
3846 -
3847 - if ( $rev && $oldid ) {
3848 - // don't save oldids in the parser cache.
3849 - }
3850 - else if ( $rev ) {
3851 - $post->outputWikiText( $rev->getText(), true );
3852 - return true;
3853 - } else {
3854 - return false;
3855 - }
3856 - } else {
3857 - return true;
3858 - }
3859 - }
38603800 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r52143* Allow archivestartdays to be configured per-page with a parser function.werdna20:57, 18 June 2009

Status & tagging log