MediaWiki REL1_39
|
Marker interface for entities aware of the wiki they belong to. More...
Public Member Functions | |
assertWiki ( $wikiId) | |
Throws if $wikiId is different from the return value of getWikiId(). | |
getWikiId () | |
Get the ID of the wiki this page belongs to. | |
Marker interface for entities 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.
Examples: RevisionRecord::getId()
or PageIdentity::getId()
Definition at line 35 of file WikiAwareEntity.php.
MediaWiki\DAO\WikiAwareEntity::assertWiki | ( | $wikiId | ) |
Throws if $wikiId is different from the return value of getWikiId().
string | false | $wikiId | The wiki ID expected by the caller. Use self::LOCAL for the local wiki. |
PreconditionException | If $wikiId is not the ID of the wiki this entity belongs to. |
Referenced by WikiPage\__construct(), ParserCache\deleteOptionsKey(), ParserCache\get(), ParserCache\getDirty(), and ParserCache\save().
MediaWiki\DAO\WikiAwareEntity::getWikiId | ( | ) |
Get the ID of the wiki this page belongs to.
Implemented in MediaWiki\Block\AbstractBlock, MediaWiki\Page\PageReference, MediaWiki\Page\PageReferenceValue, MediaWiki\Page\ProperPageIdentity, WikiPage, MediaWiki\Revision\RevisionRecord, Title, User, MediaWiki\User\UserIdentityValue, and UserRightsProxy.
Referenced by MediaWiki\User\ActorCache\add().