MediaWiki  master
MediaWiki\Revision\RevisionFactory Interface Reference

Service for constructing revision objects. More...

Inheritance diagram for MediaWiki\Revision\RevisionFactory:
Collaboration diagram for MediaWiki\Revision\RevisionFactory:

Public Member Functions

 getArchiveQueryInfo ()
 Return the tables, fields, and join conditions to be selected to create a new RevisionArchiveRecord object. More...
 
 getQueryInfo ( $options=[])
 Return the tables, fields, and join conditions to be selected to create a new RevisionStoreRecord object. More...
 
 newMutableRevisionFromArray (array $fields, $queryFlags=self::READ_NORMAL, PageIdentity $page=null)
 Constructs a new RevisionRecord based on the given associative array following the MW1.29 database convention for the Revision constructor. More...
 
 newRevisionFromArchiveRow ( $row, $queryFlags=self::READ_NORMAL, PageIdentity $page=null, array $overrides=[])
 Make a fake revision object from an archive table row. More...
 
 newRevisionFromRow ( $row, $queryFlags=self::READ_NORMAL, PageIdentity $page=null)
 Constructs a RevisionRecord given a database row and content slots. More...
 

Additional Inherited Members

- Public Attributes inherited from IDBAccessObject
const READ_NONE = -1
 Constants for object loading bitfield flags (higher => higher QoS) More...
 

Detailed Description

Service for constructing revision objects.

Since
1.31
1.32 Renamed from MediaWiki\Storage\RevisionFactory
Note
This was written to act as a drop-in replacement for the corresponding static methods in Revision.

Definition at line 38 of file RevisionFactory.php.

Member Function Documentation

◆ getArchiveQueryInfo()

MediaWiki\Revision\RevisionFactory::getArchiveQueryInfo ( )

Return the tables, fields, and join conditions to be selected to create a new RevisionArchiveRecord object.

Since
1.37, since 1.31 on RevisionStore
Returns
array With three keys:
  • tables: (string[]) to include in the $table to IDatabase->select()
  • fields: (string[]) to include in the $vars to IDatabase->select()
  • joins: (array) to include in the $join_conds to IDatabase->select()

Implemented in MediaWiki\Revision\RevisionStore.

◆ getQueryInfo()

MediaWiki\Revision\RevisionFactory::getQueryInfo (   $options = [])

Return the tables, fields, and join conditions to be selected to create a new RevisionStoreRecord object.

MCR migration note: this replaces Revision::getQueryInfo

If the format of fields returned changes in any way then the cache key provided by self::getRevisionRowCacheKey should be updated.

Since
1.37, since 1.31 on RevisionStore
Parameters
array$optionsAny combination of the following strings
  • 'page': Join with the page table, and select fields to identify the page
  • 'user': Join with the user table, and select the user name
Returns
array[] With three keys:
  • tables: (string[]) to include in the $table to IDatabase->select()
  • fields: (string[]) to include in the $vars to IDatabase->select()
  • joins: (array) to include in the $join_conds to IDatabase->select()

Implemented in MediaWiki\Revision\RevisionStore.

◆ newMutableRevisionFromArray()

MediaWiki\Revision\RevisionFactory::newMutableRevisionFromArray ( array  $fields,
  $queryFlags = self::READ_NORMAL,
PageIdentity  $page = null 
)

Constructs a new RevisionRecord based on the given associative array following the MW1.29 database convention for the Revision constructor.

MCR migration note: this replaces Revision::newFromRow

Deprecated:
since 1.31, hard deprecated since 1.36' Use a MutableRevisionRecord instead.
Parameters
array$fields
int$queryFlagsFlags for lazy loading behavior, see IDBAccessObject::READ_XXX.
PageIdentity | null$page
Returns
MutableRevisionRecord
Exceptions
MWException

Implemented in MediaWiki\Revision\RevisionStore.

◆ newRevisionFromArchiveRow()

MediaWiki\Revision\RevisionFactory::newRevisionFromArchiveRow (   $row,
  $queryFlags = self::READ_NORMAL,
PageIdentity  $page = null,
array  $overrides = [] 
)

Make a fake revision object from an archive table row.

This is queried for permissions or even inserted (as in Special:Undelete).

The user ID and user name may optionally be supplied using the aliases ar_user and ar_user_text (the names of fields which existed before MW 1.34).

MCR migration note: this replaces Revision::newFromArchiveRow

Parameters
\\stdClass$rowA query result row as a raw object. Use getArchiveQueryInfo() to build a query that yields the required fields.
int$queryFlagsFlags for lazy loading behavior, see IDBAccessObject::READ_XXX.
PageIdentity | null$page
array$overridesAn associative array that allows fields in $row to be overwritten. Keys in this array correspond to field names in $row without the "ar_" prefix, so $overrides['user'] will override $row->ar_user, etc.
Returns
RevisionRecord

Implemented in MediaWiki\Revision\RevisionStore.

◆ newRevisionFromRow()

MediaWiki\Revision\RevisionFactory::newRevisionFromRow (   $row,
  $queryFlags = self::READ_NORMAL,
PageIdentity  $page = null 
)

Constructs a RevisionRecord given a database row and content slots.

MCR migration note: this replaces Revision::newFromRow for rows based on the revision, slot, and content tables defined for MCR since MW1.31.

Parameters
\\stdClass$rowA query result row as a raw object. Use getQueryInfo() to build a query that yields the required fields.
int$queryFlagsFlags for lazy loading behavior, see IDBAccessObject::READ_XXX.
PageIdentity | null$pageA page object for the revision.
Returns
RevisionRecord

The documentation for this interface was generated from the following file: