RecordHistory

Class for fetching the history entries of a record (and if it is a page, its sub elements as well)

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
$rollbackFields  : string
Either "table:uid" or "table:uid:field" to know which data should be rolled back
$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
getCreationInformationForMultipleRecords()  : array<string|int, mixed>
Fetches the history entry for an ADD/creation action for a list of records
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
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
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.
sanitizeRollbackFieldsValue()  : string
Evaluates if the rollback field is correct
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 = []

$rollbackFields

Either "table:uid" or "table:uid:field" to know which data should be rolled back

protected string $rollbackFields = ''

$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 = '' ][, string $rollbackFields = '' ]) : mixed
Parameters
$element : string = ''

in the form of "tablename:uid"

$rollbackFields : string = ''

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>

getCreationInformationForMultipleRecords()

Fetches the history entry for an ADD/creation action for a list of records

public getCreationInformationForMultipleRecords(string $table, array<string|int, mixed> $recordIds) : array<string|int, mixed>
Parameters
$table : string
$recordIds : array<string|int, mixed>
Internal

only to be used in TYPO3 Core

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>|null

getDiff()

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

Internal
Return values
array<string|int, mixed>

Array of history data of the record

getLastHistoryEntryNumber()

public getLastHistoryEntryNumber() : int
Return values
int

getUserIdFromDeleteActionForRecord()

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
int

setLastHistoryEntryNumber()

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

getHistoryData()

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>

hasPageAccess()

Determines whether user has access to a page.

protected hasPageAccess(string $table, int $uid) : bool
Parameters
$table : string
$uid : int
Return values
bool

hasTableAccess()

Determines whether user has access to a table.

protected hasTableAccess(string $table) : bool
Parameters
$table : string
Return values
bool

prepareEventDataFromQueryBuilder()

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
string

sanitizeRollbackFieldsValue()

Evaluates if the rollback field is correct

protected sanitizeRollbackFieldsValue(string $value) : string
Parameters
$value : string
Return values
string

updateCurrentElement()

protected updateCurrentElement() : void

        
On this page

Search results