MediaWiki  master
MediaWiki\Revision\RevisionFactory Interface Reference

Service for constructing RevisionRecord 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...
 
 isRevisionRow ( $row, string $table='')
 Determine whether the parameter is a row containing all the fields that RevisionFactory needs to create a RevisionRecord from the row. More...
 
 newRevisionFromArchiveRow ( $row, $queryFlags=self::READ_NORMAL, PageIdentity $page=null, array $overrides=[])
 Make a fake RevisionRecord 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 RevisionRecord 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 the old Revision class (which was later removed in 1.37).

Definition at line 37 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 replaced 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.

◆ isRevisionRow()

MediaWiki\Revision\RevisionFactory::isRevisionRow (   $row,
string  $table = '' 
)

Determine whether the parameter is a row containing all the fields that RevisionFactory needs to create a RevisionRecord from the row.

Parameters
mixed$row
string$table'archive' or empty
Returns
bool

Implemented in MediaWiki\Revision\RevisionStore.

◆ newRevisionFromArchiveRow()

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

Make a fake RevisionRecord 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 replaced 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 replaced 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: