return ( $this->mcrMigrationStage & $flags ) === $flags;
}
+ /**
+ * Throws a RevisionAccessException if this RevisionStore is configured for cross-wiki loading
+ * and still reading from the old DB schema.
+ *
+ * @throws RevisionAccessException
+ */
+ private function assertCrossWikiContentLoadingIsSafe() {
+ if ( $this->wikiId !== false && $this->hasMcrSchemaFlags( SCHEMA_COMPAT_READ_OLD ) ) {
+ throw new RevisionAccessException(
+ "Cross-wiki content loading is not supported by the pre-MCR schema"
+ );
+ }
+ }
+
public function setLogger( LoggerInterface $logger ) {
$this->logger = $logger;
}
// MCR migration note: rev_content_model and rev_content_format will go away
if ( $this->contentHandlerUseDB ) {
+ $this->assertCrossWikiContentLoadingIsSafe();
+
$defaultModel = ContentHandler::getDefaultModelFor( $title );
$defaultFormat = ContentHandler::getForModelID( $defaultModel )->getDefaultFormat();
// if $wgContentHandlerUseDB is not set,
// all revisions must use the default content model and format.
+ $this->assertCrossWikiContentLoadingIsSafe();
+
$defaultModel = ContentHandler::getDefaultModelFor( $title );
$defaultHandler = ContentHandler::getForModelID( $defaultModel );
$defaultFormat = $defaultHandler->getDefaultFormat();
if ( $mainSlotRow->model_name === null ) {
$mainSlotRow->model_name = function ( SlotRecord $slot ) use ( $title ) {
+ $this->assertCrossWikiContentLoadingIsSafe();
+
// TODO: MCR: consider slot role in getDefaultModelFor()! Use LinkTarget!
// TODO: MCR: deprecate $title->getModel().
return ContentHandler::getDefaultModelFor( $title );
* @param ActorMigration $actorMigration
* @param int $migrationStage
* @param LoggerSpi $loggerProvider
- * @param bool $contentHandlerUseDB see {@link $wgContentHandlerUseDB}
+ * @param bool $contentHandlerUseDB see {@link $wgContentHandlerUseDB}. Must be the same
+ * for all wikis in the cluster. Will go away after MCR migration.
*/
public function __construct(
ILBFactory $dbLoadBalancerFactory,