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\Storage
;
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.
37 interface RevisionLookup
extends IDBAccessObject
{
40 * Load a page revision from a given revision ID number.
41 * Returns null if no such revision can be found.
43 * MCR migration note: this replaces Revision::newFromId
48 * @param int $flags bit field, see IDBAccessObject::READ_XXX
49 * @return RevisionRecord|null
51 public function getRevisionById( $id, $flags = 0 );
54 * Load either the current, or a specified, revision
55 * that's attached to a given link target. If not attached
56 * to that link target, will return null.
58 * MCR migration note: this replaces Revision::newFromTitle
60 * @param LinkTarget $linkTarget
61 * @param int $revId (optional)
62 * @param int $flags bit field, see IDBAccessObject::READ_XXX
63 * @return RevisionRecord|null
65 public function getRevisionByTitle( LinkTarget
$linkTarget, $revId = 0, $flags = 0 );
68 * Load either the current, or a specified, revision
69 * that's attached to a given page ID.
70 * Returns null if no such revision can be found.
72 * MCR migration note: this replaces Revision::newFromPageId
75 * @param int $revId (optional)
76 * @param int $flags bit field, see IDBAccessObject::READ_XXX
77 * @return RevisionRecord|null
79 public function getRevisionByPageId( $pageId, $revId = 0, $flags = 0 );
82 * Get previous revision for this title
84 * MCR migration note: this replaces Revision::getPrevious
86 * @param RevisionRecord $rev
88 * @return RevisionRecord|null
90 public function getPreviousRevision( RevisionRecord
$rev );
93 * Get next revision for this title
95 * MCR migration note: this replaces Revision::getNext
97 * @param RevisionRecord $rev
99 * @return RevisionRecord|null
101 public function getNextRevision( RevisionRecord
$rev );
104 * Load a revision based on a known page ID and current revision ID from the DB
106 * This method allows for the use of caching, though accessing anything that normally
107 * requires permission checks (aside from the text) will trigger a small DB lookup.
109 * MCR migration note: this replaces Revision::newKnownCurrent
111 * @param Title $title the associated page title
112 * @param int $revId current revision of this page
114 * @return RevisionRecord|bool Returns false if missing
116 public function getKnownCurrentRevision( Title
$title, $revId );