EntityStore that collects stats for edit save times.
More...
|
| __construct (EntityStore $entityStore, StatsdDataFactoryInterface $stats, string $timingPrefix) |
|
| 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.
|
|
EntityStore that collects stats for edit save times.
- Copyright
- GPL-2.0-or-later
◆ __construct()
Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore::__construct |
( |
EntityStore | $entityStore, |
|
|
StatsdDataFactoryInterface | $stats, |
|
|
string | $timingPrefix ) |
- Parameters
-
EntityStore | $entityStore | |
StatsdDataFactoryInterface | $stats | |
string | $timingPrefix | Resulting metric will be: $timingPrefix.saveEntity.<entitytype> |
◆ assignFreshId()
Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore::assignFreshId |
( |
EntityDocument | $entity | ) |
|
Assigns a fresh ID to the given entity.
- Note
- The new ID is "consumed" after this method returns, and will not be assigned to another other entity. The next available ID for each kind of entity is considered part of the persistent state of the Wikibase installation.
-
calling this method on an Entity that already has an ID, and specifically calling this method twice on the same entity, shall result in an exception.
- Parameters
-
- Exceptions
-
Implements Wikibase\Lib\Store\EntityStore.
◆ canCreateWithCustomId()
Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore::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.
- See also
- EntityHandler::canCreateWithCustomId
- Parameters
-
- Returns
- bool
Implements Wikibase\Lib\Store\EntityStore.
◆ deleteEntity()
Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore::deleteEntity |
( |
EntityId | $entityId, |
|
|
| $reason, |
|
|
User | $user ) |
Deletes the given entity in some underlying storage mechanism.
- Parameters
-
EntityId | $entityId | |
string | $reason | the reason for deletion |
User | $user | |
- Exceptions
-
StorageException | |
PermissionsError | |
Implements Wikibase\Lib\Store\EntityStore.
◆ isWatching()
Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore::isWatching |
( |
User | $user, |
|
|
EntityId | $id ) |
Determines whether the given user is watching the given item.
- Todo
- move this to a separate service
- Parameters
-
User | $user | |
EntityId | $id | the entity to watch |
- Returns
- bool
Implements Wikibase\Lib\Store\EntityStore.
◆ saveEntity()
Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore::saveEntity |
( |
EntityDocument | $entity, |
|
|
| $summary, |
|
|
User | $user, |
|
|
| $flags = 0, |
|
|
| $baseRevId = false, |
|
|
array | $tags = [] ) |
Saves the given Entity to some underlying storage mechanism.
- Note
- If the item does not have an ID yet (i.e. it was not yet created in the database), saveEntity() will fail with a edit-gone-missing message unless the EDIT_NEW bit is set in $flags. If EDIT_NEW is set and the Entity does not yet have an ID, a new ID is assigned using assignFreshId().
-
if the save is triggered by any kind of user interaction, consider using EditEntity::attemptSave(), which automatically handles edit conflicts, permission checks, etc.
- Parameters
-
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 ). |
- See also
- WikiPage::doEditContent
- Returns
- EntityRevision
- Exceptions
-
StorageException | |
PermissionsError | |
Implements Wikibase\Lib\Store\EntityStore.
◆ saveRedirect()
Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore::saveRedirect |
( |
EntityRedirect | $redirect, |
|
|
| $summary, |
|
|
User | $user, |
|
|
| $flags = 0, |
|
|
| $baseRevId = false, |
|
|
array | $tags = [] ) |
Saves the given EntityRedirect to some underlying storage mechanism.
- Parameters
-
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 ). |
- See also
- WikiPage::doEditContent
- Returns
- int The new revision ID
- Exceptions
-
StorageException | |
PermissionsError | |
Implements Wikibase\Lib\Store\EntityStore.
◆ updateWatchlist()
Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore::updateWatchlist |
( |
User | $user, |
|
|
EntityId | $id, |
|
|
| $watch ) |
Watches or unwatches the entity.
- Todo
- move this to a separate service
- Parameters
-
User | $user | |
EntityId | $id | the entity to watch |
bool | $watch | whether to watch or unwatch the page. |
- Returns
- void
Implements Wikibase\Lib\Store\EntityStore.
◆ userWasLastToEdit()
Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore::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.
- See also
- \MediaWiki\EditPage\EditPage::userWasLastToEdit()
- Parameters
-
User | $user | |
EntityId | $id | the entity to check |
int | $lastRevId | the revision to check from |
- Returns
- bool
Implements Wikibase\Lib\Store\EntityStore.
◆ $entityStore
Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore::$entityStore |
|
private |
◆ $stats
Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore::$stats |
|
private |
◆ $timingPrefix
Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore::$timingPrefix |
|
private |
The documentation for this class was generated from the following file: