summaryrefslogtreecommitdiff
path: root/includes/api/ApiPurge.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiPurge.php')
-rw-r--r--includes/api/ApiPurge.php38
1 files changed, 33 insertions, 5 deletions
diff --git a/includes/api/ApiPurge.php b/includes/api/ApiPurge.php
index 9e9320fb..9fedaf1b 100644
--- a/includes/api/ApiPurge.php
+++ b/includes/api/ApiPurge.php
@@ -88,13 +88,13 @@ class ApiPurge extends ApiBase {
if ( !$user->pingLimiter() ) {
global $wgParser, $wgEnableParserCache;
- $popts = ParserOptions::newFromContext( $this->getContext() );
+ $popts = $page->makeParserOptions( 'canonical' );
$p_result = $wgParser->parse( $page->getRawText(), $title, $popts,
true, true, $page->getLatest() );
# Update the links tables
- $u = new LinksUpdate( $title, $p_result );
- $u->doUpdate();
+ $updates = $p_result->getSecondaryDataUpdates( $title );
+ DataUpdate::runUpdates( $updates );
$r['linkupdate'] = '';
@@ -103,7 +103,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;
}
}
@@ -133,6 +134,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.'
@@ -143,7 +172,6 @@ class ApiPurge extends ApiBase {
$psModule = new ApiPageSet( $this );
return array_merge(
parent::getPossibleErrors(),
- array( array( 'cantpurge' ), ),
$psModule->getPossibleErrors()
);
}