fix merge of Iec98e472
[lhc/web/wiklou.git] / includes / api / ApiPurge.php
index d9acba4..3cf32ad 100644 (file)
@@ -86,14 +86,17 @@ class ApiPurge extends ApiBase {
 
                        if( $forceLinkUpdate ) {
                                if ( !$user->pingLimiter() ) {
-                                       global $wgParser, $wgEnableParserCache;
+                                       global $wgEnableParserCache;
 
                                        $popts = $page->makeParserOptions( 'canonical' );
-                                       $p_result = $wgParser->parse( $page->getRawText(), $title, $popts,
-                                               true, true, $page->getLatest() );
+                                       $popts->setTidy( true );
+
+                                       # Parse content; note that HTML generation is only needed if we want to cache the result.
+                                       $content = $page->getContent( Revision::RAW );
+                                       $p_result = $content->getParserOutput( $title, $page->getLatest(), $popts, $wgEnableParserCache );
 
                                        # Update the links tables
-                                       $updates = $p_result->getSecondaryDataUpdates( $title );
+                                       $updates = $content->getSecondaryDataUpdates( $title, null, true, $p_result );
                                        DataUpdate::runUpdates( $updates );
 
                                        $r['linkupdate'] = '';
@@ -172,7 +175,6 @@ class ApiPurge extends ApiBase {
                $psModule = new ApiPageSet( $this );
                return array_merge(
                        parent::getPossibleErrors(),
-                       array( array( 'cantpurge' ), ),
                        $psModule->getPossibleErrors()
                );
        }