namespace MediaWiki\Storage;
-use ApiStashEdit;
use CategoryMembershipChangeJob;
use Content;
use ContentHandler;
use LinksUpdate;
use LogicException;
use MediaWiki\Edit\PreparedEdit;
+use MediaWiki\MediaWikiServices;
use MediaWiki\Revision\MutableRevisionRecord;
use MediaWiki\Revision\RenderedRevision;
use MediaWiki\Revision\RevisionRecord;
// TODO: MCR: allow output for all slots to be stashed.
if ( $useStash && $slotsUpdate->isModifiedSlot( SlotRecord::MAIN ) ) {
- $mainContent = $slotsUpdate->getModifiedSlot( SlotRecord::MAIN )->getContent();
- $legacyUser = User::newFromIdentity( $user );
- $stashedEdit = ApiStashEdit::checkCache( $title, $mainContent, $legacyUser );
+ $editStash = MediaWikiServices::getInstance()->getPageEditStash();
+ $stashedEdit = $editStash->checkCache(
+ $title,
+ $slotsUpdate->getModifiedSlot( SlotRecord::MAIN )->getContent(),
+ User::newFromIdentity( $user )
+ );
}
$userPopts = ParserOptions::newFromUserAndLang( $user, $this->contLang );
return;
}
- if ( $this->options['oldcountable'] === 'no-change' ||
- ( !$this->options['changed'] && !$this->options['moved'] )
- ) {
- $good = 0;
- } elseif ( $this->options['created'] ) {
- $good = (int)$this->isCountable();
- } elseif ( $this->options['oldcountable'] !== null ) {
- $good = (int)$this->isCountable()
- - (int)$this->options['oldcountable'];
- } elseif ( isset( $this->pageState['oldCountable'] ) ) {
- $good = (int)$this->isCountable()
- - (int)$this->pageState['oldCountable'];
- } else {
- $good = 0;
- }
- $edits = $this->options['changed'] ? 1 : 0;
- $pages = $this->options['created'] ? 1 : 0;
+ DeferredUpdates::addCallableUpdate( function () {
+ if (
+ $this->options['oldcountable'] === 'no-change' ||
+ ( !$this->options['changed'] && !$this->options['moved'] )
+ ) {
+ $good = 0;
+ } elseif ( $this->options['created'] ) {
+ $good = (int)$this->isCountable();
+ } elseif ( $this->options['oldcountable'] !== null ) {
+ $good = (int)$this->isCountable()
+ - (int)$this->options['oldcountable'];
+ } elseif ( isset( $this->pageState['oldCountable'] ) ) {
+ $good = (int)$this->isCountable()
+ - (int)$this->pageState['oldCountable'];
+ } else {
+ $good = 0;
+ }
+ $edits = $this->options['changed'] ? 1 : 0;
+ $pages = $this->options['created'] ? 1 : 0;
- DeferredUpdates::addUpdate( SiteStatsUpdate::factory(
- [ 'edits' => $edits, 'articles' => $good, 'pages' => $pages ]
- ) );
+ DeferredUpdates::addUpdate( SiteStatsUpdate::factory(
+ [ 'edits' => $edits, 'articles' => $good, 'pages' => $pages ]
+ ) );
+ } );
// TODO: make search infrastructure aware of slots!
$mainSlot = $this->revision->getSlot( SlotRecord::MAIN );