RecordHistory
Class for fetching the history entries of a record (and if it is a page, its sub elements as well)
This class is an implementation detail of the backend record history controller and is not considered part of the public TYPO3 API.
Table of Contents
Properties
- $element : string
- Element reference, syntax [tablename]:[uid]
- $lastHistoryEntry : int
- sys_history uid which is selected
- $maxSteps : int
- Maximum number of sys_history steps to show.
- $pageAccessCache : array<string|int, mixed>
- Internal cache
- $showSubElements : bool
- On a pages table - show sub elements as well.
Methods
- __construct() : mixed
- Constructor to define which element to work on - can be overridden with "setLastHistoryEntryNumber"
- findEventsForCorrelation() : array<string|int, mixed>
- findEventsForRecord() : array<string|int, mixed>
- Queries the DB and prepares the results Resolving a WSOL of the UID and checking permissions is explicitly not part of this method
- getChangeLog() : array<string|int, mixed>
- Creates change log including sub-elements
- getCreationInformationForRecord() : array<string|int, mixed>|null
- Fetches the history entry for an ADD/creation action for a specific record.
- getDiff() : array<string|int, mixed>
- Creates a diff between the current version of the records and the selected version
- getElementInformation() : array<string|int, mixed>
- An array (0 = tablename, 1 = uid) or empty array if no element is set
- getElementString() : string
- getHistoryDataForRecord() : array<string|int, mixed>
- Gets history and delete/insert data from sys_log and sys_history
- getLastHistoryEntryNumber() : int
- getTranslations() : array{page: int, elements: array{element: string, language: int}[]}|null
- Compile a list of record history elements that belong to the same translation root.
- getUserIdFromDeleteActionForRecord() : int
- Get the user uid of the user who deleted the record for the given table
- setLastHistoryEntryNumber() : void
- If a specific history entry is selected, then the relevant element is resolved for that.
- setMaxSteps() : void
- Define the maximum amount of history entries to be shown. Beware of side-effects when using "showSubElements" as well.
- setShowSubElements() : void
- Defines to show the history of a specific record or its subelements (when it's a page) as well.
- getBackendUser() : BackendUserAuthentication
- getHistoryData() : array<string|int, mixed>
- Fetches the history data of a record + includes subelements if this is from a page
- getHistoryEntry() : array<string|int, mixed>
- Resolve tablename + record uid from sys_history UID
- getQueryBuilder() : QueryBuilder
- getTcaSchema() : TcaSchema|null
- getTcaSchemaFactory() : TcaSchemaFactory
- hasPageAccess() : bool
- Determines whether user has access to a page.
- hasTableAccess() : bool
- Determines whether user has access to a table.
- prepareEventDataFromQueryBuilder() : array<string|int, mixed>
- resolveElement() : int
- Convert input element reference to workspace version if any.
- sanitizeElementValue() : string
- Sanitizes the values for the expected disposal.
- updateCurrentElement() : void
Properties
$element
Element reference, syntax [tablename]:[uid]
protected
string
$element
= ''
$lastHistoryEntry
sys_history uid which is selected
protected
int
$lastHistoryEntry
= 0
$maxSteps
Maximum number of sys_history steps to show.
protected
int
$maxSteps
= 20
$pageAccessCache
Internal cache
protected
array<string|int, mixed>
$pageAccessCache
= []
$showSubElements
On a pages table - show sub elements as well.
protected
bool
$showSubElements
= true
Methods
__construct()
Constructor to define which element to work on - can be overridden with "setLastHistoryEntryNumber"
public
__construct([string $element = '' ]) : mixed
Parameters
- $element : string = ''
-
in the form of "tablename:uid"
findEventsForCorrelation()
public
findEventsForCorrelation(string $correlationId) : array<string|int, mixed>
Parameters
- $correlationId : string
Return values
array<string|int, mixed>findEventsForRecord()
Queries the DB and prepares the results Resolving a WSOL of the UID and checking permissions is explicitly not part of this method
public
findEventsForRecord(string $table, int $uid[, int $limit = 0 ][, int|null $minimumUid = null ]) : array<string|int, mixed>
Parameters
- $table : string
- $uid : int
- $limit : int = 0
- $minimumUid : int|null = null
Return values
array<string|int, mixed>getChangeLog()
Creates change log including sub-elements
public
getChangeLog() : array<string|int, mixed>
Return values
array<string|int, mixed>getCreationInformationForRecord()
Fetches the history entry for an ADD/creation action for a specific record.
public
getCreationInformationForRecord(string $table, array<string|int, mixed> $record) : array<string|int, mixed>|null
Parameters
- $table : string
- $record : array<string|int, mixed>
Return values
array<string|int, mixed>|nullgetDiff()
Creates a diff between the current version of the records and the selected version
public
getDiff(array<string|int, mixed> $changeLog) : array<string|int, mixed>
Parameters
- $changeLog : array<string|int, mixed>
Return values
array<string|int, mixed> —Diff for many elements
getElementInformation()
An array (0 = tablename, 1 = uid) or empty array if no element is set
public
getElementInformation() : array<string|int, mixed>
Return values
array<string|int, mixed>getElementString()
public
getElementString() : string
Return values
string —named "tablename:uid"
getHistoryDataForRecord()
Gets history and delete/insert data from sys_log and sys_history
public
getHistoryDataForRecord(string $table, int $uid[, int|null $lastHistoryEntry = null ]) : array<string|int, mixed>
Parameters
- $table : string
-
DB table name
- $uid : int
-
UID of record
- $lastHistoryEntry : int|null = null
-
the highest entry to be fetched
Return values
array<string|int, mixed> —Array of history data of the record
getLastHistoryEntryNumber()
public
getLastHistoryEntryNumber() : int
Return values
intgetTranslations()
Compile a list of record history elements that belong to the same translation root.
public
getTranslations(string $element) : array{page: int, elements: array{element: string, language: int}[]}|null
Parameters
- $element : string
Return values
array{page: int, elements: array{element: string, language: int}[]}|nullgetUserIdFromDeleteActionForRecord()
Get the user uid of the user who deleted the record for the given table
public
getUserIdFromDeleteActionForRecord(string $table, int $uid) : int
Parameters
- $table : string
- $uid : int
Return values
intsetLastHistoryEntryNumber()
If a specific history entry is selected, then the relevant element is resolved for that.
public
setLastHistoryEntryNumber(int $lastHistoryEntry) : void
Parameters
- $lastHistoryEntry : int
setMaxSteps()
Define the maximum amount of history entries to be shown. Beware of side-effects when using "showSubElements" as well.
public
setMaxSteps(int $maxSteps) : void
Parameters
- $maxSteps : int
setShowSubElements()
Defines to show the history of a specific record or its subelements (when it's a page) as well.
public
setShowSubElements(bool $showSubElements) : void
Parameters
- $showSubElements : bool
getBackendUser()
protected
getBackendUser() : BackendUserAuthentication
Return values
BackendUserAuthenticationgetHistoryData()
Fetches the history data of a record + includes subelements if this is from a page
protected
getHistoryData(string $table, int $uid[, bool|null $includeSubEntries = null ][, int $lastHistoryEntry = null ]) : array<string|int, mixed>
Parameters
- $table : string
- $uid : int
- $includeSubEntries : bool|null = null
- $lastHistoryEntry : int = null
-
the highest entry to be evaluated
Return values
array<string|int, mixed>getHistoryEntry()
Resolve tablename + record uid from sys_history UID
protected
getHistoryEntry(int $lastHistoryEntry) : array<string|int, mixed>
Parameters
- $lastHistoryEntry : int
Return values
array<string|int, mixed>getQueryBuilder()
protected
getQueryBuilder() : QueryBuilder
Return values
QueryBuildergetTcaSchema()
protected
getTcaSchema(string $table) : TcaSchema|null
Parameters
- $table : string
Return values
TcaSchema|nullgetTcaSchemaFactory()
protected
getTcaSchemaFactory() : TcaSchemaFactory
Return values
TcaSchemaFactoryhasPageAccess()
Determines whether user has access to a page.
protected
hasPageAccess(string $table, int $uid) : bool
Parameters
- $table : string
- $uid : int
Return values
boolhasTableAccess()
Determines whether user has access to a table.
protected
hasTableAccess(string $table) : bool
Parameters
- $table : string
Return values
boolprepareEventDataFromQueryBuilder()
protected
prepareEventDataFromQueryBuilder(QueryBuilder $queryBuilder) : array<string|int, mixed>
Parameters
- $queryBuilder : QueryBuilder
Return values
array<string|int, mixed>resolveElement()
Convert input element reference to workspace version if any.
protected
resolveElement(string $table, int $uid) : int
Parameters
- $table : string
-
Table of input element
- $uid : int
-
UID of record
Return values
int —converted UID of record
sanitizeElementValue()
Sanitizes the values for the expected disposal.
protected
sanitizeElementValue(string $value) : string
Invalid values will be converted to an empty string.
Parameters
- $value : string
-
the value of the element value
Return values
stringupdateCurrentElement()
protected
updateCurrentElement() : void