From: Alexandre Emsenhuber Date: Sat, 5 Nov 2011 19:17:15 +0000 (+0000) Subject: * Use WikiPage instead of Article for doPurge(), getting raw wikitext and ParserCache... X-Git-Tag: 1.31.0-rc.0~26688 X-Git-Url: http://git.cyclocoop.org/data/%24oldEdit?a=commitdiff_plain;h=2bca9b829f5978f342960acd370daf8c83ac8469;p=lhc%2Fweb%2Fwiklou.git * Use WikiPage instead of Article for doPurge(), getting raw wikitext and ParserCache access * Use ParserOptions::newFromContext() --- diff --git a/includes/api/ApiPurge.php b/includes/api/ApiPurge.php index 89885b3da2..db5d22b36e 100644 --- a/includes/api/ApiPurge.php +++ b/includes/api/ApiPurge.php @@ -68,17 +68,17 @@ class ApiPurge extends ApiBase { $result[] = $r; continue; } - $context = new DerivativeContext( $this->getContext() ); - $context->setTitle( $title ); - $article = Article::newFromTitle( $title, $context ); - $article->doPurge(); // Directly purge and skip the UI part of purge(). + + $page = WikiPage::factory( $title ); + $page->doPurge(); // Directly purge and skip the UI part of purge(). $r['purged'] = ''; if( $forceLinkUpdate ) { if ( !$user->pingLimiter() ) { global $wgParser, $wgEnableParserCache; - $popts = new ParserOptions(); - $p_result = $wgParser->parse( $article->getContent(), $title, $popts ); + + $popts = ParserOptions::newFromContext( $this->getContext() ); + $p_result = $wgParser->parse( $page->getRawText(), $title, $popts ); # Update the links tables $u = new LinksUpdate( $title, $p_result ); @@ -88,7 +88,7 @@ class ApiPurge extends ApiBase { if ( $wgEnableParserCache ) { $pcache = ParserCache::singleton(); - $pcache->save( $p_result, $article, $popts ); + $pcache->save( $p_result, $page, $popts ); } } else { $this->setWarning( $this->parseMsg( array( 'actionthrottledtext' ) ) );