ApiQueryBase::addTitleInfo( $r, $title );
$page = WikiPage::factory( $title );
if ( !$user->pingLimiter( 'purge' ) ) {
- $page->doPurge(); // Directly purge and skip the UI part of purge().
+ $flags = WikiPage::PURGE_ALL;
+ if ( !$this->getRequest()->wasPosted() ) {
+ $flags ^= WikiPage::PURGE_GLOBAL_PCACHE; // skip DB_MASTER write
+ }
+ // Directly purge and skip the UI part of purge()
+ $page->doPurge( $flags );
$r['purged'] = true;
} else {
$error = $this->parseMsg( [ 'actionthrottledtext' ] );
# Parse content; note that HTML generation is only needed if we want to cache the result.
$content = $page->getContent( Revision::RAW );
- $enableParserCache = $this->getConfig()->get( 'EnableParserCache' );
- $p_result = $content->getParserOutput(
- $title,
- $page->getLatest(),
- $popts,
- $enableParserCache
- );
-
- # Logging to better see expensive usage patterns
- if ( $forceRecursiveLinkUpdate ) {
- LoggerFactory::getInstance( 'RecursiveLinkPurge' )->info(
- "Recursive link purge enqueued for {title}",
- [
- 'user' => $this->getUser()->getName(),
- 'title' => $title->getPrefixedText()
- ]
+ if ( $content ) {
+ $enableParserCache = $this->getConfig()->get( 'EnableParserCache' );
+ $p_result = $content->getParserOutput(
+ $title,
+ $page->getLatest(),
+ $popts,
+ $enableParserCache
);
- }
-
- # Update the links tables
- $updates = $content->getSecondaryDataUpdates(
- $title, null, $forceRecursiveLinkUpdate, $p_result );
- DataUpdate::runUpdates( $updates );
-
- $r['linkupdate'] = true;
- if ( $enableParserCache ) {
- $pcache = ParserCache::singleton();
- $pcache->save( $p_result, $page, $popts );
+ # Logging to better see expensive usage patterns
+ if ( $forceRecursiveLinkUpdate ) {
+ LoggerFactory::getInstance( 'RecursiveLinkPurge' )->info(
+ "Recursive link purge enqueued for {title}",
+ [
+ 'user' => $this->getUser()->getName(),
+ 'title' => $title->getPrefixedText()
+ ]
+ );
+ }
+
+ # Update the links tables
+ $updates = $content->getSecondaryDataUpdates(
+ $title, null, $forceRecursiveLinkUpdate, $p_result );
+ foreach ( $updates as $update ) {
+ DeferredUpdates::addUpdate( $update, DeferredUpdates::PRESEND );
+ }
+
+ $r['linkupdate'] = true;
+
+ if ( $enableParserCache ) {
+ $pcache = ParserCache::singleton();
+ $pcache->save( $p_result, $page, $popts );
+ }
}
} else {
$error = $this->parseMsg( [ 'actionthrottledtext' ] );