Page MenuHomePhabricator

Support dispatching changes for entities in non-main slots
Open, Needs TriagePublic

Description

Currently, Wikibase only supports dispatching changes for entities that are stored in the main slot of a page, more or less by accident.

RepoHooks::onRevisionFromEditComplete()
		if ( $entityContentFactory->isEntityContentModel( $wikiPage->getContent()->getModel() ) ) {
			self::notifyEntityStoreWatcherOnUpdate(
				$revisionRecord->getContent( SlotRecord::MAIN ),
				$revisionRecord
			);

			$notifier = WikibaseRepo::getChangeNotifier();
			// ...

(WikiPage::getContent() hard-codes the main slot.)

ChangeNotifier::notifyOnPageModified()
		/** @var EntityContent $parentContent */
		$parentContent = $parent->getContent( SlotRecord::MAIN );
		'@phan-var EntityContent $parentContent';
		$content = $current->getContent( SlotRecord::MAIN );
		// ...

For changes to MediaInfo entities (stored in the mediainfo slot of file pages), we never create any changes, the wb_changes table remains empty, there is nothing to dispatch, pages using entity data (over 140 million, according to wbc_entity_usage) aren’t updated. We probably want to fix this – however: the impact of this on Commons (suddenly many more jobs in the job queue) should be carefully considered, possibly with a staged rollout.