3 * Service for looking up page revisions.
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.
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.
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
23 namespace MediaWiki\Revision
;
26 use MediaWiki\Linker\LinkTarget
;
30 * Service for looking up page revisions.
32 * @note This was written to act as a drop-in replacement for the corresponding
33 * static methods in Revision.
36 * @since 1.32 Renamed from MediaWiki\Storage\RevisionLookup
38 interface RevisionLookup
extends IDBAccessObject
{
41 * Load a page revision from a given revision ID number.
42 * Returns null if no such revision can be found.
44 * MCR migration note: this replaces Revision::newFromId
49 * @param int $flags bit field, see IDBAccessObject::READ_XXX
50 * @return RevisionRecord|null
52 public function getRevisionById( $id, $flags = 0 );
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.
59 * MCR migration note: this replaces Revision::newFromTitle
61 * @param LinkTarget $linkTarget
62 * @param int $revId (optional)
63 * @param int $flags bit field, see IDBAccessObject::READ_XXX
64 * @return RevisionRecord|null
66 public function getRevisionByTitle( LinkTarget
$linkTarget, $revId = 0, $flags = 0 );
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.
73 * MCR migration note: this replaces Revision::newFromPageId
76 * @param int $revId (optional)
77 * @param int $flags bit field, see IDBAccessObject::READ_XXX
78 * @return RevisionRecord|null
80 public function getRevisionByPageId( $pageId, $revId = 0, $flags = 0 );
83 * Get previous revision for this title
85 * MCR migration note: this replaces Revision::getPrevious
87 * @param RevisionRecord $rev
88 * @param int $flags (optional) $flags include:
89 * IDBAccessObject::READ_LATEST: Select the data from the master
91 * @return RevisionRecord|null
93 public function getPreviousRevision( RevisionRecord
$rev, $flags = 0 );
96 * Get next revision for this title
98 * MCR migration note: this replaces Revision::getNext
100 * @param RevisionRecord $rev
101 * @param int $flags (optional) $flags include:
102 * IDBAccessObject::READ_LATEST: Select the data from the master
104 * @return RevisionRecord|null
106 public function getNextRevision( RevisionRecord
$rev, $flags = 0 );
109 * Get rev_timestamp from rev_id, without loading the rest of the row.
111 * MCR migration note: this replaces Revision::getTimestampFromId
115 * @return string|bool False if not found
116 * @since 1.34 (present earlier in RevisionStore)
118 public function getTimestampFromId( $id, $flags = 0 );
121 * Load a revision based on a known page ID and current revision ID from the DB
123 * This method allows for the use of caching, though accessing anything that normally
124 * requires permission checks (aside from the text) will trigger a small DB lookup.
126 * MCR migration note: this replaces Revision::newKnownCurrent
128 * @param Title $title the associated page title
129 * @param int $revId current revision of this page
131 * @return RevisionRecord|bool Returns false if missing
133 public function getKnownCurrentRevision( Title
$title, $revId );
138 * Retain the old class name for backwards compatibility.
139 * @deprecated since 1.32
141 class_alias( RevisionLookup
::class, 'MediaWiki\Storage\RevisionLookup' );