*
* @since 1.19
* @param ParserOptions $parserOptions ParserOptions to use for the parse operation
- * @param null|int $oldid Revision ID to get the text from, passing null or 0 will
- * get the current revision (default value)
- *
- * @return ParserOutput|bool ParserOutput or false if the revision was not found
+ * @param null|int $oldid Revision ID to get the text from, passing null or 0 will
+ * get the current revision (default value)
+ * @param bool $forceParse Force reindexing, regardless of cache settings
+ * @return bool|ParserOutput ParserOutput or false if the revision was not found
*/
- public function getParserOutput( ParserOptions $parserOptions, $oldid = null ) {
+ public function getParserOutput( ParserOptions $parserOptions, $oldid = null,
+ $forceParse = false ) {
- $useParserCache = $this->shouldCheckParserCache( $parserOptions, $oldid );
+ $useParserCache =
+ ( !$forceParse ) && $this->shouldCheckParserCache( $parserOptions, $oldid );
wfDebug( __METHOD__ .
': using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
if ( $parserOptions->getStubThreshold() ) {
return false;
}
- $title = $this->mTitle;
- wfGetDB( DB_MASTER )->onTransactionIdle( function() use ( $title ) {
- // Invalidate the cache in auto-commit mode
- $title->invalidateCache();
- } );
-
+ $this->mTitle->invalidateCache();
// Send purge after above page_touched update was committed
DeferredUpdates::addUpdate(
- new CdnCacheUpdate( $title->getCdnUrls() ),
+ new CdnCacheUpdate( $this->mTitle->getCdnUrls() ),
DeferredUpdates::PRESEND
);
}
// Do secondary updates once the main changes have been committed...
- $that = $this;
- $dbw->onTransactionIdle(
- function () use (
- $dbw, &$that, $revision, &$user, $content, $summary, &$flags,
- $changed, $meta, &$status
- ) {
- // Do per-page updates in a transaction
- $dbw->setFlag( DBO_TRX );
- // Update links tables, site stats, etc.
- $that->doEditUpdates(
- $revision,
- $user,
- [
- 'changed' => $changed,
- 'oldcountable' => $meta['oldCountable'],
- 'oldrevision' => $meta['oldRevision']
- ]
- );
- // Trigger post-save hook
- $params = [ &$that, &$user, $content, $summary, $flags & EDIT_MINOR,
- null, null, &$flags, $revision, &$status, $meta['baseRevId'] ];
- ContentHandler::runLegacyHooks( 'ArticleSaveComplete', $params );
- Hooks::run( 'PageContentSaveComplete', $params );
- }
+ DeferredUpdates::addUpdate(
+ new AtomicSectionUpdate(
+ $dbw,
+ __METHOD__,
+ function () use (
+ $revision, &$user, $content, $summary, &$flags,
+ $changed, $meta, &$status
+ ) {
+ // Update links tables, site stats, etc.
+ $this->doEditUpdates(
+ $revision,
+ $user,
+ [
+ 'changed' => $changed,
+ 'oldcountable' => $meta['oldCountable'],
+ 'oldrevision' => $meta['oldRevision']
+ ]
+ );
+ // Trigger post-save hook
+ $params = [ &$this, &$user, $content, $summary, $flags & EDIT_MINOR,
+ null, null, &$flags, $revision, &$status, $meta['baseRevId'] ];
+ ContentHandler::runLegacyHooks( 'ArticleSaveComplete', $params );
+ Hooks::run( 'PageContentSaveComplete', $params );
+ }
+ ),
+ DeferredUpdates::PRESEND
);
return $status;
$status->value['revision'] = $revision;
// Do secondary updates once the main changes have been committed...
- $that = $this;
- $dbw->onTransactionIdle(
- function () use (
- &$that, $dbw, $revision, &$user, $content, $summary, &$flags, $meta, &$status
- ) {
- // Do per-page updates in a transaction
- $dbw->setFlag( DBO_TRX );
- // Update links, etc.
- $that->doEditUpdates( $revision, $user, [ 'created' => true ] );
- // Trigger post-create hook
- $params = [ &$that, &$user, $content, $summary,
- $flags & EDIT_MINOR, null, null, &$flags, $revision ];
- ContentHandler::runLegacyHooks( 'ArticleInsertComplete', $params );
- Hooks::run( 'PageContentInsertComplete', $params );
- // Trigger post-save hook
- $params = array_merge( $params, [ &$status, $meta['baseRevId'] ] );
- ContentHandler::runLegacyHooks( 'ArticleSaveComplete', $params );
- Hooks::run( 'PageContentSaveComplete', $params );
+ DeferredUpdates::addUpdate(
+ new AtomicSectionUpdate(
+ $dbw,
+ __METHOD__,
+ function () use (
+ $revision, &$user, $content, $summary, &$flags, $meta, &$status
+ ) {
+ // Update links, etc.
+ $this->doEditUpdates( $revision, $user, [ 'created' => true ] );
+ // Trigger post-create hook
+ $params = [ &$this, &$user, $content, $summary,
+ $flags & EDIT_MINOR, null, null, &$flags, $revision ];
+ ContentHandler::runLegacyHooks( 'ArticleInsertComplete', $params );
+ Hooks::run( 'PageContentInsertComplete', $params );
+ // Trigger post-save hook
+ $params = array_merge( $params, [ &$status, $meta['baseRevId'] ] );
+ ContentHandler::runLegacyHooks( 'ArticleSaveComplete', $params );
+ Hooks::run( 'PageContentSaveComplete', $params );
- }
+ }
+ ),
+ DeferredUpdates::PRESEND
);
return $status;
}
if ( $this->mPreparedEdit
- && $this->mPreparedEdit->newContent
+ && isset( $this->mPreparedEdit->newContent )
&& $this->mPreparedEdit->newContent->equals( $content )
&& $this->mPreparedEdit->revid == $revid
&& $this->mPreparedEdit->format == $serialFormat
],
__METHOD__
);
+ // Save this so we can pass it to the ArticleDeleteComplete hook.
+ $archivedRevisionCount = $dbw->affectedRows();
// Now that it's safely backed up, delete it
$dbw->delete( 'page', [ 'page_id' => $id ], __METHOD__ );
$this->doDeleteUpdates( $id, $content );
Hooks::run( 'ArticleDeleteComplete',
- [ &$this, &$user, $reason, $id, $content, $logEntry ] );
+ [ &$this, &$user, $reason, $id, $content, $logEntry, $archivedRevisionCount ] );
$status->value = $logid;
// Show log excerpt on 404 pages rather than just a link