3 * Service for constructing revision objects.
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
;
29 * Service for constructing revision objects.
32 * @since 1.32 Renamed from MediaWiki\Storage\RevisionFactory
34 * @note This was written to act as a drop-in replacement for the corresponding
35 * static methods in Revision.
37 interface RevisionFactory
{
40 * Constructs a new RevisionRecord based on the given associative array following the MW1.29
41 * database convention for the Revision constructor.
43 * MCR migration note: this replaces Revision::newFromRow
45 * @deprecated since 1.31. Use a MutableRevisionRecord instead.
47 * @param array $fields
48 * @param int $queryFlags Flags for lazy loading behavior, see IDBAccessObject::READ_XXX.
49 * @param Title|null $title
51 * @return MutableRevisionRecord
54 public function newMutableRevisionFromArray( array $fields, $queryFlags = 0, Title
$title = null );
57 * Constructs a RevisionRecord given a database row and content slots.
59 * MCR migration note: this replaces Revision::newFromRow for rows based on the
60 * revision, slot, and content tables defined for MCR since MW1.31.
62 * @param object $row A query result row as a raw object.
63 * Use RevisionStore::getQueryInfo() to build a query that yields the required fields.
64 * @param int $queryFlags Flags for lazy loading behavior, see IDBAccessObject::READ_XXX.
65 * @param Title|null $title
67 * @return RevisionRecord
69 public function newRevisionFromRow( $row, $queryFlags = 0, Title
$title = null );
72 * Make a fake revision object from an archive table row. This is queried
73 * for permissions or even inserted (as in Special:Undelete)
75 * MCR migration note: this replaces Revision::newFromArchiveRow
77 * @param object $row A query result row as a raw object.
78 * Use RevisionStore::getArchiveQueryInfo() to build a query that yields the
80 * @param int $queryFlags Flags for lazy loading behavior, see IDBAccessObject::READ_XXX.
81 * @param Title|null $title
82 * @param array $overrides An associative array that allows fields in $row to be overwritten.
83 * Keys in this array correspond to field names in $row without the "ar_" prefix, so
84 * $overrides['user'] will override $row->ar_user, etc.
86 * @return RevisionRecord
88 public function newRevisionFromArchiveRow(
98 * Retain the old class name for backwards compatibility.
99 * @deprecated since 1.32
101 class_alias( RevisionFactory
::class, 'MediaWiki\Storage\RevisionFactory' );