Merge ".mailmap: Correct two contributor names"
[mediawiki.git] / includes / page / PageRecord.php
blobb0f6d0df28b1bf19f20940c5bea1ac6463024231
1 <?php
3 namespace MediaWiki\Page;
5 /**
6 * Data record representing a page that is (or used to be, or could be)
7 * an editable page on a wiki.
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.
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.
20 * @see https://www.mediawiki.org/wiki/Manual:Modeling_pages
22 * @stable to type
23 * @since 1.36
24 * @ingroup Page
26 interface PageRecord extends ProperPageIdentity {
28 /**
29 * False if the page has had more than one edit.
31 * @warning this is not guaranteed to always return true for old pages that have only one edit.
33 * @return bool
35 public function isNew();
37 /**
38 * True if the page is a redirect.
40 * @return bool
42 public function isRedirect();
44 /**
45 * The ID of the page's latest revision.
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.
51 * @return int The revision ID of the page's latest revision, or 0 if the page does not exist.
53 public function getLatest( $wikiId = self::LOCAL );
55 /**
56 * Timestamp at which the page was last flagged for rerendering.
58 * @return string
60 public function getTouched();
62 /**
63 * The page's language, if explicitly recorded.
64 * The effective page language needs to be determined programmatically.
66 * @return ?string
68 public function getLanguage();