Wikibase
MediaWiki Wikibase extension
|
Storage interface for Entities. More...
Public Member Functions | |
assignFreshId (EntityDocument $entity) | |
Assigns a fresh ID to the given entity. | |
saveEntity (EntityDocument $entity, $summary, User $user, $flags=0, $baseRevId=false, array $tags=[]) | |
Saves the given Entity to some underlying storage mechanism. | |
saveRedirect (EntityRedirect $redirect, $summary, User $user, $flags=0, $baseRevId=false, array $tags=[]) | |
Saves the given EntityRedirect to some underlying storage mechanism. | |
deleteEntity (EntityId $entityId, $reason, User $user) | |
Deletes the given entity in some underlying storage mechanism. | |
userWasLastToEdit (User $user, EntityId $id, $lastRevId) | |
Check if no edits were made by other users since the given revision. | |
updateWatchlist (User $user, EntityId $id, $watch) | |
Watches or unwatches the entity. | |
isWatching (User $user, EntityId $id) | |
Determines whether the given user is watching the given item. | |
canCreateWithCustomId (EntityId $id) | |
Whether an entity with the given custom ID can exist. | |
Storage interface for Entities.
Wikibase\Lib\Store\EntityStore::assignFreshId | ( | EntityDocument | $entity | ) |
Assigns a fresh ID to the given entity.
EntityDocument | $entity |
StorageException |
Implemented in Wikibase\Lib\Store\TypeDispatchingEntityStore, Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore, and Wikibase\Repo\Store\Sql\WikiPageEntityStore.
Wikibase\Lib\Store\EntityStore::canCreateWithCustomId | ( | EntityId | $id | ) |
Whether an entity with the given custom ID can exist.
Implementations are not required to check if an entity with the given ID already exists. If this method returns true, this means that an entity with the given ID could be created (or already existed) at the time the method was called. There is no guarantee that this continues to be true after the method call returned. Callers must be careful to handle race conditions.
EntityId | $id |
Implemented in Wikibase\Lib\Store\TypeDispatchingEntityStore, Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore, and Wikibase\Repo\Store\Sql\WikiPageEntityStore.
Wikibase\Lib\Store\EntityStore::deleteEntity | ( | EntityId | $entityId, |
$reason, | |||
User | $user ) |
Deletes the given entity in some underlying storage mechanism.
EntityId | $entityId | |
string | $reason | the reason for deletion |
User | $user |
StorageException | |
PermissionsError |
Implemented in Wikibase\Lib\Store\TypeDispatchingEntityStore, Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore, and Wikibase\Repo\Store\Sql\WikiPageEntityStore.
Wikibase\Lib\Store\EntityStore::isWatching | ( | User | $user, |
EntityId | $id ) |
Determines whether the given user is watching the given item.
User | $user | |
EntityId | $id | the entity to watch |
Implemented in Wikibase\Lib\Store\TypeDispatchingEntityStore, Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore, and Wikibase\Repo\Store\Sql\WikiPageEntityStore.
Wikibase\Lib\Store\EntityStore::saveEntity | ( | EntityDocument | $entity, |
$summary, | |||
User | $user, | ||
$flags = 0, | |||
$baseRevId = false, | |||
array | $tags = [] ) |
Saves the given Entity to some underlying storage mechanism.
EntityDocument | $entity | the entity to save. |
string | $summary | the edit summary for the new revision. |
User | $user | the user to whom to attribute the edit |
int | $flags | EDIT_XXX flags, as defined for WikiPage::doEditContent. Additionally, the EntityContent::EDIT_XXX constants can be used. |
int | bool | $baseRevId | the revision ID $entity is based on. Saving should fail if $baseRevId is no longer the current revision. |
string[] | $tags | Change tags to add to the edit. Callers are responsible for permission checks (typically using ChangeTagsStore::canAddTagsAccompanyingChange ). |
StorageException | |
PermissionsError |
Implemented in Wikibase\Lib\Store\TypeDispatchingEntityStore, Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore, and Wikibase\Repo\Store\Sql\WikiPageEntityStore.
Wikibase\Lib\Store\EntityStore::saveRedirect | ( | EntityRedirect | $redirect, |
$summary, | |||
User | $user, | ||
$flags = 0, | |||
$baseRevId = false, | |||
array | $tags = [] ) |
Saves the given EntityRedirect to some underlying storage mechanism.
EntityRedirect | $redirect | the redirect to save. |
string | $summary | the edit summary for the new revision. |
User | $user | the user to whom to attribute the edit |
int | $flags | EDIT_XXX flags, as defined for WikiPage::doEditContent. |
int | bool | $baseRevId | the revision ID $entity is based on. Saving should fail if $baseRevId is no longer the current revision. |
string[] | $tags | Change tags to add to the edit. Callers are responsible for permission checks (typically using ChangeTagsStore::canAddTagsAccompanyingChange ). |
StorageException | |
PermissionsError |
Implemented in Wikibase\Lib\Store\TypeDispatchingEntityStore, Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore, and Wikibase\Repo\Store\Sql\WikiPageEntityStore.
Wikibase\Lib\Store\EntityStore::updateWatchlist | ( | User | $user, |
EntityId | $id, | ||
$watch ) |
Watches or unwatches the entity.
User | $user | |
EntityId | $id | the entity to watch |
bool | $watch | whether to watch or unwatch the page. |
Implemented in Wikibase\Lib\Store\TypeDispatchingEntityStore, Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore, and Wikibase\Repo\Store\Sql\WikiPageEntityStore.
Wikibase\Lib\Store\EntityStore::userWasLastToEdit | ( | User | $user, |
EntityId | $id, | ||
$lastRevId ) |
Check if no edits were made by other users since the given revision.
This makes the assumption that revision ids are monotonically increasing.
User | $user | |
EntityId | $id | the entity to check |
int | $lastRevId | the revision to check from |
Implemented in Wikibase\Lib\Store\TypeDispatchingEntityStore, Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore, and Wikibase\Repo\Store\Sql\WikiPageEntityStore.