if( $forceLinkUpdate ) {
if ( !$user->pingLimiter() ) {
- global $wgParser, $wgEnableParserCache;
+ global $wgEnableParserCache;
- $popts = ParserOptions::newFromContext( $this->getContext() );
+ $popts = $page->makeParserOptions( 'canonical' );
$popts->setTidy( true );
- $p_result = $wgParser->parse( $page->getRawText(), $title, $popts,
- true, true, $page->getLatest() );
+
+ # 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'] = '';
);
}
+ public function getResultProperties() {
+ return array(
+ ApiBase::PROP_LIST => true,
+ '' => array(
+ 'ns' => array(
+ ApiBase::PROP_TYPE => 'namespace',
+ ApiBase::PROP_NULLABLE => true
+ ),
+ 'title' => array(
+ ApiBase::PROP_TYPE => 'string',
+ ApiBase::PROP_NULLABLE => true
+ ),
+ 'pageid' => array(
+ ApiBase::PROP_TYPE => 'integer',
+ ApiBase::PROP_NULLABLE => true
+ ),
+ 'revid' => array(
+ ApiBase::PROP_TYPE => 'integer',
+ ApiBase::PROP_NULLABLE => true
+ ),
+ 'invalid' => 'boolean',
+ 'missing' => 'boolean',
+ 'purged' => 'boolean',
+ 'linkupdate' => 'boolean'
+ )
+ );
+ }
+
public function getDescription() {
return array( 'Purge the cache for the given titles.',
'Requires a POST request if the user is not logged in.'
$psModule = new ApiPageSet( $this );
return array_merge(
parent::getPossibleErrors(),
- array( array( 'cantpurge' ), ),
$psModule->getPossibleErrors()
);
}