2 namespace MediaWiki\Storage
;
4 use MediaWiki\Content\Content
;
5 use MediaWiki\Page\PageIdentity
;
6 use MediaWiki\Parser\ParserOutput
;
7 use MediaWiki\Revision\RenderedRevision
;
8 use MediaWiki\Revision\RevisionRecord
;
11 * An object representing a page update during an edit.
13 * Instances of PreparedUpdate may be passed to hook handlers to provide them with
14 * access to the rendered version of a revision that is about to be saved, or has
17 * MCR migration note: this replaces PreparedEdit
22 interface PreparedUpdate
{
25 * Returns the identity of the page being updated
27 * @return PageIdentity
29 public function getPage(): PageIdentity
;
32 * Returns the content of the given slot, with no audience checks.
34 * @param string $role slot role name
37 * @throws PageUpdateException If the slot is neither set for update nor inherited from the
40 public function getRawContent( string $role ): Content
;
43 * Whether the page will be countable after the edit.
47 public function isCountable(): bool;
50 * Whether the page will be a redirect after the edit.
54 public function isRedirect(): bool;
57 * Returns the update's target revision - that is, the revision that will be the current
58 * revision after the update.
60 * @return RevisionRecord
62 public function getRevision(): RevisionRecord
;
65 * Returns a RenderedRevision instance acting as a lazy holder for the ParserOutput
68 * @return RenderedRevision
70 public function getRenderedRevision(): RenderedRevision
;
73 * Returns the role names of the slots added or updated by the new revision.
74 * Does not include the role names of slots that are being removed.
76 * @see RevisionSlotsUpdate::getModifiedRoles
80 public function getModifiedSlotRoles(): array;
83 * Returns the role names of the slots removed by the new revision.
87 public function getRemovedSlotRoles(): array;
90 * Returns the canonical parser output.
92 * Code that does not need access to the rendered HTML should use getParserOutputForMetaData()
95 * @return ParserOutput
97 public function getCanonicalParserOutput(): ParserOutput
;
100 * Returns the canonical parser output without requiring rendering.
101 * It may not be safe to call getText() on the resulting ParserOutput.
103 * Code that does not need to the rendered HTML should prefer this method
104 * over getCanonicalParserOutput() since it will be significantly faster for
105 * some types of content. This would typically be the case for structured data,
106 * for which extracting data is simple, but rendering may require loading
109 * @return ParserOutput
111 public function getParserOutputForMetaData(): ParserOutput
;