| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Page; |
| 4 | |
| 5 | /** |
| 6 | * Data record representing a page that is (or used to be, or could be) |
| 7 | * an editable page on a wiki. |
| 8 | * |
| 9 | * For compatibility with the WikiPage class, PageIdentity instances may |
| 10 | * represent non-existing pages. In the future, the contract of this interface is intended |
| 11 | * to be changed to disallow this. PageIdentity instances may also |
| 12 | * be mutable, and return different values from methods such as getLatest() or isRedirect() |
| 13 | * at different times. In the future, the contract of this interface is intended |
| 14 | * to be changed to disallow this. |
| 15 | * |
| 16 | * Only WikiPage should implement PageRecord directly, other implementations should use |
| 17 | * ExistingPageRecord instead. Once WikiPage is removed or guaranteed to be immutable and |
| 18 | * existing, ExistingPageRecord will become an alias of PageRecord. |
| 19 | * |
| 20 | * @see https://www.mediawiki.org/wiki/Manual:Modeling_pages |
| 21 | * |
| 22 | * @stable to type |
| 23 | * @since 1.36 |
| 24 | * @ingroup Page |
| 25 | */ |
| 26 | interface PageRecord extends ProperPageIdentity { |
| 27 | |
| 28 | /** |
| 29 | * False if the page has had more than one edit. |
| 30 | * |
| 31 | * @warning this is not guaranteed to always return true for old pages that have only one edit. |
| 32 | * |
| 33 | * @return bool |
| 34 | */ |
| 35 | public function isNew(); |
| 36 | |
| 37 | /** |
| 38 | * True if the page is a redirect. |
| 39 | * |
| 40 | * @return bool |
| 41 | */ |
| 42 | public function isRedirect(); |
| 43 | |
| 44 | /** |
| 45 | * The ID of the page's latest revision. |
| 46 | * |
| 47 | * @param string|false $wikiId Must be provided when accessing the ID of the latest revision of |
| 48 | * a non-local PageRecord, to prevent data corruption when using a PageRecord belonging |
| 49 | * to one wiki in the context of another. Should be omitted if expecting the local wiki. |
| 50 | * |
| 51 | * @return int The revision ID of the page's latest revision, or 0 if the page does not exist. |
| 52 | */ |
| 53 | public function getLatest( $wikiId = self::LOCAL ); |
| 54 | |
| 55 | /** |
| 56 | * Timestamp at which the page was last flagged for rerendering. |
| 57 | * |
| 58 | * @return string |
| 59 | */ |
| 60 | public function getTouched(); |
| 61 | |
| 62 | /** |
| 63 | * The page's language, if explicitly recorded. |
| 64 | * The effective page language needs to be determined programmatically. |
| 65 | * |
| 66 | * @return ?string |
| 67 | */ |
| 68 | public function getLanguage(); |
| 69 | } |