https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102109

Revision: 102109
Author:   ialex
Date:     2011-11-05 19:17:15 +0000 (Sat, 05 Nov 2011)
Log Message:
-----------
* Use WikiPage instead of Article for doPurge(), getting raw wikitext and 
ParserCache access
* Use ParserOptions::newFromContext()

Modified Paths:
--------------
    trunk/phase3/includes/api/ApiPurge.php

Modified: trunk/phase3/includes/api/ApiPurge.php
===================================================================
--- trunk/phase3/includes/api/ApiPurge.php      2011-11-05 17:10:18 UTC (rev 
102108)
+++ trunk/phase3/includes/api/ApiPurge.php      2011-11-05 19:17:15 UTC (rev 
102109)
@@ -68,18 +68,18 @@
                                $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 
);
                                        $u->doUpdate();
@@ -88,7 +88,7 @@
 
                                        if ( $wgEnableParserCache ) {
                                                $pcache = 
ParserCache::singleton();
-                                               $pcache->save( $p_result, 
$article, $popts );
+                                               $pcache->save( $p_result, 
$page, $popts );
                                        }
                                } else {
                                        $this->setWarning( $this->parseMsg( 
array( 'actionthrottledtext' ) ) );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to