From 2bca9b829f5978f342960acd370daf8c83ac8469 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 5 Nov 2011 19:17:15 +0000 Subject: [PATCH] * Use WikiPage instead of Article for doPurge(), getting raw wikitext and ParserCache access * Use ParserOptions::newFromContext() --- includes/api/ApiPurge.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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' ) ) ); -- 2.20.1