X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiPurge.php;h=3cf32adc917d74a362c7415e2d9c2fb27ec6dde4;hb=7af8c74e1a799f26ba81fc95d8f0f2dbead52bfc;hp=8ef9cbc0e3a9511c61f4c1c129969011c197b5ac;hpb=ba7a5f70f40eaba6b7a7d343da200e1f0fb776b7;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiPurge.php b/includes/api/ApiPurge.php index 8ef9cbc0e3..3cf32adc91 100644 --- a/includes/api/ApiPurge.php +++ b/includes/api/ApiPurge.php @@ -86,15 +86,17 @@ class ApiPurge extends ApiBase { 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'] = ''; @@ -104,7 +106,8 @@ class ApiPurge extends ApiBase { $pcache->save( $p_result, $page, $popts ); } } else { - $this->setWarning( $this->parseMsg( array( 'actionthrottledtext' ) ) ); + $error = $this->parseMsg( array( 'actionthrottledtext' ) ); + $this->setWarning( $error['info'] ); $forceLinkUpdate = false; } } @@ -134,6 +137,34 @@ class ApiPurge extends ApiBase { ); } + 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.' @@ -144,7 +175,6 @@ class ApiPurge extends ApiBase { $psModule = new ApiPageSet( $this ); return array_merge( parent::getPossibleErrors(), - array( array( 'cantpurge' ), ), $psModule->getPossibleErrors() ); }