WikiPage and PageUpdater make use "edit flags" represented as a bitfield using the EDIT_XXX constants. At least some of these flags need to be represented in the PageUpdatedEvent somehow.
The contract of these flags are defined in the documentation of WikiPage::doUSerEditContent:
* @param int $flags Bitfield: * EDIT_NEW * Article is known or assumed to be non-existent, create a new one * EDIT_UPDATE * Article is known or assumed to be pre-existing, update it * EDIT_MINOR * Mark this edit minor, if the user is allowed to do so * EDIT_SUPPRESS_RC * Do not log the change in recentchanges * EDIT_FORCE_BOT * Mark the edit a "bot" edit regardless of user rights * EDIT_AUTOSUMMARY * Fill in blank summaries with generated text where possible * EDIT_INTERNAL * Signal that the page retrieve/save cycle happened entirely in this request.
The significance of these flags to event consumers is as follows:
- EDIT_NEW and EDIT_UPDATE are irrelevant. They are basically used as a "check and set" feature to prevent race conditions during edits.
- EDIT_AUTOSUMMARY is not relevant, it just instructs PageUpdater to automatically create the edit summary.
- EDIT_SUPPRESS_RC seems to be the must relevant: it's needed in ChangeTrackingInventIngress to decide whether to add an entry to recentChnages, and it's set by a large number of use cases.
- EDIT_MINOR and EDIT_FORCE_BOT are needed to create RecentChanges entries, at the very least.
- EDIT_INTERNAL indicates that the edit was not interactive. It is used to decide whether to check the EditStash. Note however that it cannot be used to decide whther an edit should be counted against the user's edit count, see (T382592). We need a separate flag for that.
The following questions need to be answered for modeling these flags in PageUpdatedEvent:
- Should the flags be looped through blindly, without the event class being aware of their meaning?
- DECISION: no, but we will try to avoid event flags that are 'instructions' for specific consumers, and instead model them as things that happened.
- Alternatively, should the flags be only accessible through individual getters, and not as a bit field?
- DECISION: the flag bitfield should not be directly accessible.
- How should these flags be serialized for use outside of MediaWiki?
- TBD: but likely either as booleans or a list of strings.
- Should we add a flag that indicates whether an edit should contribute to the user edit count?
- DECISION: yes, as an 'implicit edit'.