Manual:WikiAwareEntity.php
MediaWiki file: WikiAwareEntity.php | |
---|---|
Location: | includes/dao/ |
Source code: | master • 1.43.0 • 1.42.4 • 1.39.11 |
Classes: | MediaWiki\DAO\WikiAwareEntity |
A marker interface for entities that are aware of the wiki they belong to. Instances of classes implementing this interface belong to a specific wiki and may be used in a cross-wiki context.
- Services using these classes have to ensure the entities they operate on belong to the correct wiki by calling
assertWiki()
. - Additionally, some getters of implementing classes can take an optional
$wikiId
parameter to assert on for extra protection against incorrect cross-wiki access. The parameter should be added if using the property in the context of a wrong wiki will cause DB corruption. Usually the rule of thumb is fields which are commonly used as foreign keys, like page_id, rev_id, user_id, actor_id etc. However, the exact line is left to the best judgement of the implementers.
Methods
edit- assertWiki( $wikiId )
- getWikiId()