use LinksUpdate;
use LogicException;
use MediaWiki\Edit\PreparedEdit;
+use MediaWiki\Revision\MutableRevisionRecord;
use MediaWiki\Revision\RenderedRevision;
+use MediaWiki\Revision\RevisionRecord;
use MediaWiki\Revision\RevisionRenderer;
+use MediaWiki\Revision\RevisionSlots;
+use MediaWiki\Revision\RevisionStore;
+use MediaWiki\Revision\SlotRecord;
use MediaWiki\User\UserIdentity;
use MessageCache;
use ParserCache;
$this->jobQueueGroup = $jobQueueGroup;
$this->messageCache = $messageCache;
$this->contLang = $contLang;
- // XXX only needed for waiting for slaves to catch up; there should be a narrower
+ // XXX only needed for waiting for replicas to catch up; there should be a narrower
// interface for that.
$this->loadbalancerFactory = $loadbalancerFactory;
}
}
// TODO: MCR: ask all slots if they have links [SlotHandler/PageTypeHandler]
- $mainContent = $this->getRawContent( 'main' );
+ $mainContent = $this->getRawContent( SlotRecord::MAIN );
return $mainContent->isCountable( $hasLinks );
}
*/
public function isRedirect() {
// NOTE: main slot determines redirect status
- $mainContent = $this->getRawContent( 'main' );
+ $mainContent = $this->getRawContent( SlotRecord::MAIN );
return $mainContent->isRedirect();
}
*/
private function revisionIsRedirect( RevisionRecord $rev ) {
// NOTE: main slot determines redirect status
- $mainContent = $rev->getContent( 'main', RevisionRecord::RAW );
+ $mainContent = $rev->getContent( SlotRecord::MAIN, RevisionRecord::RAW );
return $mainContent->isRedirect();
}
$stashedEdit = false;
// TODO: MCR: allow output for all slots to be stashed.
- if ( $useStash && $slotsUpdate->isModifiedSlot( 'main' ) ) {
- $mainContent = $slotsUpdate->getModifiedSlot( 'main' )->getContent();
+ if ( $useStash && $slotsUpdate->isModifiedSlot( SlotRecord::MAIN ) ) {
+ $mainContent = $slotsUpdate->getModifiedSlot( SlotRecord::MAIN )->getContent();
$legacyUser = User::newFromIdentity( $user );
$stashedEdit = ApiStashEdit::checkCache( $title, $mainContent, $legacyUser );
}
// No PST for inherited slots! Note that "modified" slots may still be inherited
// from an earlier version, e.g. for rollbacks.
$pstSlot = $slot;
- } elseif ( $role === 'main' && $stashedEdit ) {
+ } elseif ( $role === SlotRecord::MAIN && $stashedEdit ) {
// TODO: MCR: allow PST content for all slots to be stashed.
$pstSlot = SlotRecord::newUnsaved( $role, $stashedEdit->pstContent );
} else {
$preparedEdit->popts = $this->getCanonicalParserOptions();
$preparedEdit->output = $this->getCanonicalParserOutput();
- $preparedEdit->pstContent = $this->revision->getContent( 'main' );
+ $preparedEdit->pstContent = $this->revision->getContent( SlotRecord::MAIN );
$preparedEdit->newContent =
- $slotsUpdate->isModifiedSlot( 'main' )
- ? $slotsUpdate->getModifiedSlot( 'main' )->getContent()
- : $this->revision->getContent( 'main' ); // XXX: can we just remove this?
+ $slotsUpdate->isModifiedSlot( SlotRecord::MAIN )
+ ? $slotsUpdate->getModifiedSlot( SlotRecord::MAIN )->getContent()
+ : $this->revision->getContent( SlotRecord::MAIN ); // XXX: can we just remove this?
$preparedEdit->oldContent = null; // unused. // XXX: could get this from the parent revision
$preparedEdit->revid = $this->revision ? $this->revision->getId() : null;
$preparedEdit->timestamp = $preparedEdit->output->getCacheTime();
// TODO: MCR: check if *any* changed slot supports categories!
if ( $this->rcWatchCategoryMembership
- && $this->getContentHandler( 'main' )->supportsCategories() === true
+ && $this->getContentHandler( SlotRecord::MAIN )->supportsCategories() === true
&& ( $this->options['changed'] || $this->options['created'] )
&& !$this->options['restored']
) {
// the recent change entry (also done via deferred updates) and carry over any
// bot/deletion/IP flags, ect.
$this->jobQueueGroup->lazyPush(
- new CategoryMembershipChangeJob(
+ CategoryMembershipChangeJob::newSpec(
$this->getTitle(),
- [
- 'pageId' => $this->getPageId(),
- 'revTimestamp' => $this->revision->getTimestamp(),
- ]
+ $this->revision->getTimestamp()
)
);
}
) );
// TODO: make search infrastructure aware of slots!
- $mainSlot = $this->revision->getSlot( 'main' );
+ $mainSlot = $this->revision->getSlot( SlotRecord::MAIN );
if ( !$mainSlot->isInherited() && !$this->isContentDeleted() ) {
DeferredUpdates::addUpdate( new SearchUpdate( $id, $dbKey, $mainSlot->getContent() ) );
}
}
if ( $title->getNamespace() == NS_MEDIAWIKI
- && $this->getRevisionSlotsUpdate()->isModifiedSlot( 'main' )
+ && $this->getRevisionSlotsUpdate()->isModifiedSlot( SlotRecord::MAIN )
) {
- $mainContent = $this->isContentDeleted() ? null : $this->getRawContent( 'main' );
+ $mainContent = $this->isContentDeleted() ? null : $this->getRawContent( SlotRecord::MAIN );
$this->messageCache->updateMessageOverride( $title, $mainContent );
}