Wikibase
MediaWiki Wikibase extension
|
Tracking happens on two levels:
This is used to optimize change notifications on two levels (see md_docs_topics_change-propagation):
Each client wiki tracks which pages use (which aspect of) which entity (from which repo). The “aspect” is used to decide which kind of change is relevant for the given kind of usage, and what kind of update is needed for the page in question. Among others the following aspects are defined:
Entity usage on client pages is tracked using the following codes (each representing one aspect):
Changes result in updates to pages that use the respective entity based on the aspect that is used. Changes are classified accordingly:
This way, editing e.g. statements will not cause pages that just show the entities label to be purged.
The database table for tracking client side usage is called wbc_entity_usage, and can be thought of as a links table, just like templatelinks or imagelinks.
Usage tracking information on the client has to be updated when pages are edited (resp. created, deleted, or renamed) and when pages are re-rendered due to a change in a template. In addition to that, usages that become apparent only when the page is rendered with a specific target language need to be tracked when such a language specific rendering is committed to the parser cache. This is particularly important for per-language tracking of label usage on multilingual wikis.
Tracking information, that needs to be added as new renderings of a page materialize, is being added to the tracking table, after the corresponding parser cache entry has been saved. Tracking data is being discarded whenever the corresponding parser cache entries are being invalidated. If that happens, we simply remove all records in wbc_entity_usage except for the ones in the new (post invalidation) parser cache entry.
This implies that entity usage tracking is actually tracking usage in page renderings (technically, entries in the parser cache). It does not directly correspond to what is or is not present in a pages wikitext or templates. However, since a page is always rendered in at least one language when it is edited, this distinction is somewhat academic.
Overview of events that trigger updates to usage tracking:
Each repo tracks which client uses which entity. This is done in the wb_changes_subscription table.
This table is updated whenever the client side tracking table is updated. To do this, the client wiki must, whenever a page is edited, determine which entities are used (in order to record this in the local tracking table), but in addition to this, detect whether an entity that wasn't used previously anywhere on the wiki is now used by the edited page, or whether the edit removed the last usage of any of the entities previously used on the page.