|
| __construct (EditEntity $editEntity, StatsdDataFactoryInterface $stats, string $timingPrefix) |
|
| getEntityId () |
| Returns the ID of the entity being edited.May be null if a new entity is to be created.- Returns
- null|EntityId
|
|
| getLatestRevision () |
| Returns the latest revision of the entity.- Returns
- EntityRevision|null
|
|
| getBaseRevision () |
| Return the base revision for the edit.If no base revision ID was supplied to the constructor, this returns the latest revision. If the entity does not exist yet, this returns null.- Returns
- EntityRevision|null
- Exceptions
-
RevisionedUnresolvedRedirectException | |
StorageException | |
|
|
| getStatus () |
| Get the status object.Only defined after attemptSave() was called.- Returns
- EditEntityStatus
|
|
| isSuccess () |
| Determines whether the last call to attemptSave was successful.- Returns
- bool false if attemptSave() failed, true otherwise
|
|
| hasError ( $errorType=self::ANY_ERROR) |
| Checks whether this EditEntity encountered any of the given error types while executing attemptSave().- Parameters
-
- Returns
- bool true if this EditEntity encountered any of the error types in $errorType, false otherwise.
|
|
| hasEditConflict () |
| Determines whether an edit conflict exists, that is, whether another user has edited the same item after the base revision was created.In other words, this method checks whether the base revision (as provided to the constructor) is still current. If no base revision was provided to the constructor, this will always return false.If the base revision is different from the current revision, this will return true even if the edit conflict is resolvable. Indeed, it is used to determine whether conflict resolution should be attempted.- Returns
- bool
|
|
| isTokenOK ( $token) |
| Make sure the given WebRequest contains a valid edit token.- Parameters
-
string | $token | The token to check. |
- Returns
- bool true if the token is valid
|
|
| attemptSave (EntityDocument $newEntity, string $summary, $flags, $token, $watch=null, array $tags=[]) |
| Attempts to save the given Entity object.This method performs entity level permission checks, checks the edit token, enforces rate limits, resolves edit conflicts, and updates user watchlists if appropriate.Success or failure are reported via the Status object returned by this method.- Todo
- $flags here should ideally not refer to EDIT_ constants from mediawiki core.
- Parameters
-
EntityDocument | $newEntity | |
string | $summary | The edit summary. |
int | $flags | The EDIT_XXX flags as used by WikiPage::doUserEditContent(). Additionally, the EntityContent::EDIT_XXX constants can be used. |
string | bool | $token | Edit token to check, or false to disable the token check. Null will fail the token text, as will the empty string. |
bool | null | $watch | Whether the user wants to watch the entity. Set to null to apply default according to getWatchDefault(). |
string[] | $tags | Change tags to add to the edit. Callers are responsible for checking that the user is permitted to add these tags (typically using ChangeTagsStore::canAddTagsAccompanyingChange ). |
- Returns
- EditEntityStatus
- Exceptions
-
- See also
- WikiPage::doUserEditContent
-
EntityStore::saveEntity
|
|
EditEntity that collects stats for edits.
- Copyright
- GPL-2.0-or-later
Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEditEntity::hasEditConflict |
( |
| ) |
|
Determines whether an edit conflict exists, that is, whether another user has edited the same item after the base revision was created.In other words, this method checks whether the base revision (as provided to the constructor) is still current. If no base revision was provided to the constructor, this will always return false.If the base revision is different from the current revision, this will return true even if the edit conflict is resolvable. Indeed, it is used to determine whether conflict resolution should be attempted.
- Returns
- bool
Implements Wikibase\Repo\EditEntity\EditEntity.