Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | namespace MediaWiki\Storage; |
3 | |
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; |
9 | |
10 | /** |
11 | * An object representing a page update during an edit. |
12 | * |
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 |
15 | * just been saved. |
16 | * |
17 | * MCR migration note: this replaces PreparedEdit |
18 | * |
19 | * @since 1.38 |
20 | * @ingroup Page |
21 | */ |
22 | interface PreparedUpdate { |
23 | |
24 | /** |
25 | * Returns the identity of the page being updated |
26 | * |
27 | * @return PageIdentity |
28 | */ |
29 | public function getPage(): PageIdentity; |
30 | |
31 | /** |
32 | * Returns the content of the given slot, with no audience checks. |
33 | * |
34 | * @param string $role slot role name |
35 | * |
36 | * @return Content |
37 | * @throws PageUpdateException If the slot is neither set for update nor inherited from the |
38 | * parent revision. |
39 | */ |
40 | public function getRawContent( string $role ): Content; |
41 | |
42 | /** |
43 | * Whether the page will be countable after the edit. |
44 | * |
45 | * @return bool |
46 | */ |
47 | public function isCountable(): bool; |
48 | |
49 | /** |
50 | * Whether the page will be a redirect after the edit. |
51 | * |
52 | * @return bool |
53 | */ |
54 | public function isRedirect(): bool; |
55 | |
56 | /** |
57 | * Returns the update's target revision - that is, the revision that will be the current |
58 | * revision after the update. |
59 | * |
60 | * @return RevisionRecord |
61 | */ |
62 | public function getRevision(): RevisionRecord; |
63 | |
64 | /** |
65 | * Returns a RenderedRevision instance acting as a lazy holder for the ParserOutput |
66 | * of the revision. |
67 | * |
68 | * @return RenderedRevision |
69 | */ |
70 | public function getRenderedRevision(): RenderedRevision; |
71 | |
72 | /** |
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. |
75 | * |
76 | * @see RevisionSlotsUpdate::getModifiedRoles |
77 | * |
78 | * @return string[] |
79 | */ |
80 | public function getModifiedSlotRoles(): array; |
81 | |
82 | /** |
83 | * Returns the role names of the slots removed by the new revision. |
84 | * |
85 | * @return string[] |
86 | */ |
87 | public function getRemovedSlotRoles(): array; |
88 | |
89 | /** |
90 | * Returns the canonical parser output. |
91 | * |
92 | * Code that does not need access to the rendered HTML should use getParserOutputForMetaData() |
93 | * instead. |
94 | * |
95 | * @return ParserOutput |
96 | */ |
97 | public function getCanonicalParserOutput(): ParserOutput; |
98 | |
99 | /** |
100 | * Returns the canonical parser output without requiring rendering. |
101 | * It may not be safe to call getText() on the resulting ParserOutput. |
102 | * |
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 |
107 | * additional data. |
108 | * |
109 | * @return ParserOutput |
110 | */ |
111 | public function getParserOutputForMetaData(): ParserOutput; |
112 | |
113 | } |