Remove parameter 'options' from hook 'SkinEditSectionLinks'
[lhc/web/wiklou.git] / includes / Revision / RevisionLookup.php
1 <?php
2 /**
3 * Service for looking up page revisions.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 */
22
23 namespace MediaWiki\Revision;
24
25 use IDBAccessObject;
26 use MediaWiki\Linker\LinkTarget;
27 use Title;
28
29 /**
30 * Service for looking up page revisions.
31 *
32 * @note This was written to act as a drop-in replacement for the corresponding
33 * static methods in Revision.
34 *
35 * @since 1.31
36 * @since 1.32 Renamed from MediaWiki\Storage\RevisionLookup
37 */
38 interface RevisionLookup extends IDBAccessObject {
39
40 /**
41 * Load a page revision from a given revision ID number.
42 * Returns null if no such revision can be found.
43 *
44 * MCR migration note: this replaces Revision::newFromId
45 *
46 * $flags include:
47 *
48 * @param int $id
49 * @param int $flags bit field, see IDBAccessObject::READ_XXX
50 * @return RevisionRecord|null
51 */
52 public function getRevisionById( $id, $flags = 0 );
53
54 /**
55 * Load either the current, or a specified, revision
56 * that's attached to a given link target. If not attached
57 * to that link target, will return null.
58 *
59 * MCR migration note: this replaces Revision::newFromTitle
60 *
61 * @param LinkTarget $linkTarget
62 * @param int $revId (optional)
63 * @param int $flags bit field, see IDBAccessObject::READ_XXX
64 * @return RevisionRecord|null
65 */
66 public function getRevisionByTitle( LinkTarget $linkTarget, $revId = 0, $flags = 0 );
67
68 /**
69 * Load either the current, or a specified, revision
70 * that's attached to a given page ID.
71 * Returns null if no such revision can be found.
72 *
73 * MCR migration note: this replaces Revision::newFromPageId
74 *
75 * @param int $pageId
76 * @param int $revId (optional)
77 * @param int $flags bit field, see IDBAccessObject::READ_XXX
78 * @return RevisionRecord|null
79 */
80 public function getRevisionByPageId( $pageId, $revId = 0, $flags = 0 );
81
82 /**
83 * Get previous revision for this title
84 *
85 * MCR migration note: this replaces Revision::getPrevious
86 *
87 * @param RevisionRecord $rev
88 * @param Title|null $title if known (optional)
89 *
90 * @return RevisionRecord|null
91 */
92 public function getPreviousRevision( RevisionRecord $rev, Title $title = null );
93
94 /**
95 * Get next revision for this title
96 *
97 * MCR migration note: this replaces Revision::getNext
98 *
99 * @param RevisionRecord $rev
100 * @param Title|null $title if known (optional)
101 *
102 * @return RevisionRecord|null
103 */
104 public function getNextRevision( RevisionRecord $rev, Title $title = null );
105
106 /**
107 * Load a revision based on a known page ID and current revision ID from the DB
108 *
109 * This method allows for the use of caching, though accessing anything that normally
110 * requires permission checks (aside from the text) will trigger a small DB lookup.
111 *
112 * MCR migration note: this replaces Revision::newKnownCurrent
113 *
114 * @param Title $title the associated page title
115 * @param int $revId current revision of this page
116 *
117 * @return RevisionRecord|bool Returns false if missing
118 */
119 public function getKnownCurrentRevision( Title $title, $revId );
120
121 }
122
123 /**
124 * Retain the old class name for backwards compatibility.
125 * @deprecated since 1.32
126 */
127 class_alias( RevisionLookup::class, 'MediaWiki\Storage\RevisionLookup' );