‪TYPO3CMS  10.4
TYPO3\CMS\Core\Database\ReferenceIndex Class Reference
Inheritance diagram for TYPO3\CMS\Core\Database\ReferenceIndex:

Public Member Functions

 __construct (EventDispatcherInterface $eventDispatcher=null)
 
 setWorkspaceId ($workspaceId)
 
int getWorkspaceId ()
 
array updateRefIndexTable ($tableName, $uid, $testOnly=false)
 
array null generateRefIndexData ($tableName, $uid)
 
int getNumberOfReferencedRecords (string $tableName, int $uid)
 
array null createEntryData ($table, $uid, $field, $flexPointer, $deleted, $ref_table, $ref_uid, $ref_string='', $sort=-1, $softref_key='', $softref_id='')
 
 createEntryData_dbRels ($table, $uid, $fieldName, $flexPointer, $deleted, $items)
 
 createEntryData_softreferences ($table, $uid, $fieldName, $flexPointer, $deleted, $keys)
 
array getRelations ($table, $row, $onlyField='')
 
 getRelations_flexFormCallBack ($dsArr, $dataValue, $PA, $structurePath)
 
array bool getRelations_procDB ($value, $conf, $uid, $table='')
 
string bool array setReferenceValue ($hash, $newValue, $returnDataArray=false, $bypassWorkspaceAdminCheck=false)
 
string setReferenceValue_dbRels ($refRec, $itemArray, $newValue, &$dataArray, $flexPointer='')
 
string setReferenceValue_softreferences ($refRec, $softref, $newValue, &$dataArray, $flexPointer='')
 
bool isReferenceField (array $configuration)
 
array updateIndex ($testOnly, $cli_echo=null)
 
 enableRuntimeCache ()
 
 disableRuntimeCache ()
 

Public Attributes

array $temp_flexRelations = array( )
 
array $relations = array( )
 
int $hashVersion = 1
 

Protected Member Functions

array generateDataUsingRecord (string $tableName, array $record)
 
array bool createEntryDataUsingRecord (string $tableName, array $record, string $fieldName, string $flexPointer, int $deleted, string $referencedTable, int $referencedUid, string $referenceString='', int $sort=-1, string $softReferenceKey='', string $softReferenceId='')
 
 createEntryDataForDatabaseRelationsUsingRecord (string $tableName, array $record, string $fieldName, string $flexPointer, int $deleted, array $items)
 
 createEntryDataForSoftReferencesUsingRecord (string $tableName, array $record, string $fieldName, string $flexPointer, int $deleted, array $keys)
 
bool isDbReferenceField (array $configuration)
 
string fetchTableRelationFields ($tableName)
 
 getAmountOfUnusedTablesInReferenceIndex (array $tableNames)
 
 removeReferenceIndexDataFromUnusedDatabaseTables (array $tableNames)
 
array false getRecordRawCached (string $tableName, int $uid)
 
bool shouldExcludeTableFromReferenceIndex ($tableName)
 
bool shouldExcludeTableColumnFromReferenceIndex ($tableName, $column, $onlyColumn)
 
TYPO3 CMS Core Authentication BackendUserAuthentication getBackendUser ()
 

Protected Attributes

array $recordCache = array( )
 
int $workspaceId = 0
 
TYPO3 CMS Core Cache Frontend FrontendInterface $runtimeCache
 
bool $useRuntimeCache = false
 
EventDispatcherInterface $eventDispatcher
 

Static Protected Attributes

static array $excludedTables
 
static array $excludedColumns
 
static string $cachePrefixTableRelationFields = 'core-refidx-tblRelFields-'
 

Detailed Description

Reference index processing and relation extraction

NOTICE: When the reference index is updated for an offline version the results may not be correct. First, lets assumed that the reference update happens in LIVE workspace (ALWAYS update from Live workspace if you analyze whole database!) Secondly, lets assume that in a Draft workspace you have changed the data structure of a parent page record - this is (in TemplaVoila) inherited by subpages. When in the LIVE workspace the data structure for the records/pages in the offline workspace will not be evaluated to the right one simply because the data structure is taken from a rootline traversal and in the Live workspace that will NOT include the changed DataStructure! Thus the evaluation will be based on the Data Structure set in the Live workspace! Somehow this scenario is rarely going to happen. Yet, it is an inconsistency and I see now practical way to handle it - other than simply ignoring maintaining the index for workspace records. Or we can say that the index is precise for all Live elements while glitches might happen in an offline workspace? Anyway, I just wanted to document this finding - I don't think we can find a solution for it. And its very TemplaVoila specific.

Definition at line 47 of file ReferenceIndex.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Database\ReferenceIndex::__construct ( EventDispatcherInterface  $eventDispatcher = null)
Parameters
EventDispatcherInterface$eventDispatcher

Definition at line 149 of file ReferenceIndex.php.

References TYPO3\CMS\Core\Database\ReferenceIndex\$eventDispatcher.

Member Function Documentation

◆ createEntryData()

array null TYPO3\CMS\Core\Database\ReferenceIndex::createEntryData (   $table,
  $uid,
  $field,
  $flexPointer,
  $deleted,
  $ref_table,
  $ref_uid,
  $ref_string = '',
  $sort = -1,
  $softref_key = '',
  $softref_id = '' 
)

Create array with field/value pairs ready to insert in database. The "hash" field is a fingerprint value across this table.

Parameters
string$table‪Tablename of source record (where reference is located)
int$uid‪UID of source record (where reference is located)
string$field‪Fieldname of source record (where reference is located)
string$flexPointer‪Pointer to location inside FlexForm structure where reference is located in [field]
int$deleted‪Whether record is deleted-flagged or not
string$ref_table‪For database references; the tablename the reference points to. Special keyword "_STRING" indicates some special usage (typ. softreference) where "ref_string" is used for the value.
int$ref_uid‪For database references; The UID of the record (zero "ref_table" is "_STRING")
string$ref_string‪For "_STRING" references: The string.
int$sort‪The sorting order of references if many (the "group" or "select" TCA types). -1 if no sorting order is specified.
string$softref_key‪If the reference is a soft reference, this is the soft reference parser key. Otherwise empty.
string$softref_id‪Soft reference ID for key. Might be useful for replace operations.
Returns
‪array|null Array record to insert into table.

Definition at line 438 of file ReferenceIndex.php.

◆ createEntryData_dbRels()

TYPO3\CMS\Core\Database\ReferenceIndex::createEntryData_dbRels (   $table,
  $uid,
  $fieldName,
  $flexPointer,
  $deleted,
  $items 
)

Enter database references to ->relations array

Parameters
string$table‪Tablename of source record (where reference is located)
int$uid‪UID of source record (where reference is located)
string$fieldName‪Fieldname of source record (where reference is located)
string$flexPointer‪Pointer to location inside FlexForm structure where reference is located in [field]
int$deleted‪Whether record is deleted-flagged or not
array$items‪Data array with database relations (table/id)

Definition at line 511 of file ReferenceIndex.php.

References TYPO3\CMS\Core\Database\ReferenceIndex\createEntryDataForDatabaseRelationsUsingRecord(), and TYPO3\CMS\Core\Database\ReferenceIndex\getRecordRawCached().

◆ createEntryData_softreferences()

TYPO3\CMS\Core\Database\ReferenceIndex::createEntryData_softreferences (   $table,
  $uid,
  $fieldName,
  $flexPointer,
  $deleted,
  $keys 
)

Enter softref references to ->relations array

Parameters
string$table‪Tablename of source record (where reference is located)
int$uid‪UID of source record (where reference is located)
string$fieldName‪Fieldname of source record (where reference is located)
string$flexPointer‪Pointer to location inside FlexForm structure
int$deleted
array$keys‪Data array with soft reference keys

Definition at line 554 of file ReferenceIndex.php.

References TYPO3\CMS\Core\Database\ReferenceIndex\createEntryDataForSoftReferencesUsingRecord(), and TYPO3\CMS\Core\Database\ReferenceIndex\getRecordRawCached().

◆ createEntryDataForDatabaseRelationsUsingRecord()

TYPO3\CMS\Core\Database\ReferenceIndex::createEntryDataForDatabaseRelationsUsingRecord ( string  $tableName,
array  $record,
string  $fieldName,
string  $flexPointer,
int  $deleted,
array  $items 
)
protected

Add database references to ->relations array based on fetched record

Parameters
string$tableName‪Tablename of source record (where reference is located)
array$record‪Record from $tableName
string$fieldName‪Fieldname of source record (where reference is located)
string$flexPointer‪Pointer to location inside FlexForm structure where reference is located in $fieldName
int$deleted‪Whether record is deleted-flagged or not
array$items‪Data array with database relations (table/id)

Definition at line 537 of file ReferenceIndex.php.

References TYPO3\CMS\Core\Database\ReferenceIndex\createEntryDataUsingRecord().

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\createEntryData_dbRels().

◆ createEntryDataForSoftReferencesUsingRecord()

TYPO3\CMS\Core\Database\ReferenceIndex::createEntryDataForSoftReferencesUsingRecord ( string  $tableName,
array  $record,
string  $fieldName,
string  $flexPointer,
int  $deleted,
array  $keys 
)
protected

Add SoftReference references to ->relations array based on fetched record

Parameters
string$tableName‪Tablename of source record (where reference is located)
array$record‪Record from $tableName
string$fieldName‪Fieldname of source record (where reference is located)
string$flexPointer‪Pointer to location inside FlexForm structure where reference is located in $fieldName
int$deleted‪Whether record is deleted-flagged or not
array$keys‪Data array with soft reference keys

Definition at line 580 of file ReferenceIndex.php.

References TYPO3\CMS\Core\Database\ReferenceIndex\createEntryDataUsingRecord().

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\createEntryData_softreferences().

◆ createEntryDataUsingRecord()

array bool TYPO3\CMS\Core\Database\ReferenceIndex::createEntryDataUsingRecord ( string  $tableName,
array  $record,
string  $fieldName,
string  $flexPointer,
int  $deleted,
string  $referencedTable,
int  $referencedUid,
string  $referenceString = '',
int  $sort = -1,
string  $softReferenceKey = '',
string  $softReferenceId = '' 
)
protected

Create array with field/value pairs ready to insert in database

Parameters
string$tableName‪Tablename of source record (where reference is located)
array$record‪Record from $table
string$fieldName‪Fieldname of source record (where reference is located)
string$flexPointer‪Pointer to location inside FlexForm structure where reference is located in [$field]
int$deleted‪Whether record is deleted-flagged or not
string$referencedTable‪In database references the tablename the reference points to. Keyword "_STRING" indicates special usage (typ. SoftReference) in $referenceString
int$referencedUid‪In database references the UID of the record (zero $referencedTable is "_STRING")
string$referenceString‪For "_STRING" references: The string.
int$sort‪The sorting order of references if many (the "group" or "select" TCA types). -1 if no sorting order is specified.
string$softReferenceKey‪If the reference is a soft reference, this is the soft reference parser key. Otherwise empty.
string$softReferenceId‪Soft reference ID for key. Might be useful for replace operations.
Returns
‪array|bool Array to insert in DB or false if record should not be processed

Definition at line 475 of file ReferenceIndex.php.

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\createEntryDataForDatabaseRelationsUsingRecord(), and TYPO3\CMS\Core\Database\ReferenceIndex\createEntryDataForSoftReferencesUsingRecord().

◆ disableRuntimeCache()

TYPO3\CMS\Core\Database\ReferenceIndex::disableRuntimeCache ( )

Disables the runtime-based cache

Definition at line 1412 of file ReferenceIndex.php.

◆ enableRuntimeCache()

TYPO3\CMS\Core\Database\ReferenceIndex::enableRuntimeCache ( )

Enables the runtime-based caches Could lead to side effects, depending if the reference index instance is run multiple times while records would be changed.

Definition at line 1404 of file ReferenceIndex.php.

◆ fetchTableRelationFields()

string TYPO3\CMS\Core\Database\ReferenceIndex::fetchTableRelationFields (   $tableName)
protected

Returns all fields of a table which could contain a relation

Parameters
string$tableName‪Name of the table
Returns
‪string Fields which could contain a relation

Definition at line 1039 of file ReferenceIndex.php.

References $fields, $GLOBALS, and TYPO3\CMS\Core\Database\ReferenceIndex\isReferenceField().

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\getRecordRawCached(), and TYPO3\CMS\Core\Database\ReferenceIndex\updateRefIndexTable().

◆ generateDataUsingRecord()

array TYPO3\CMS\Core\Database\ReferenceIndex::generateDataUsingRecord ( string  $tableName,
array  $record 
)
protected

Calculate the relations for a record of a given table

Parameters
string$tableName‪Table being processed
array$record‪Record from $tableName
Returns
‪array

Definition at line 371 of file ReferenceIndex.php.

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\updateRefIndexTable().

◆ generateRefIndexData()

array null TYPO3\CMS\Core\Database\ReferenceIndex::generateRefIndexData (   $tableName,
  $uid 
)

Returns array of arrays with an index of all references found in record from table/uid If the result is used to update the sys_refindex table then no workspaces must be applied (no workspace overlay anywhere!)

Parameters
string$tableName‪Table name from $GLOBALS['TCA']
int$uid‪Record UID
Returns
‪array|null Index Rows

Definition at line 314 of file ReferenceIndex.php.

◆ getAmountOfUnusedTablesInReferenceIndex()

TYPO3\CMS\Core\Database\ReferenceIndex::getAmountOfUnusedTablesInReferenceIndex ( array  $tableNames)
protected

◆ getBackendUser()

TYPO3 CMS Core Authentication BackendUserAuthentication TYPO3\CMS\Core\Database\ReferenceIndex::getBackendUser ( )
protected

Returns the current BE user.

Returns
‪\TYPO3\CMS\Core\Authentication\BackendUserAuthentication

Definition at line 1422 of file ReferenceIndex.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\setReferenceValue().

◆ getNumberOfReferencedRecords()

int TYPO3\CMS\Core\Database\ReferenceIndex::getNumberOfReferencedRecords ( string  $tableName,
int  $uid 
)

Returns the amount of references for the given record

Parameters
string$tableName
int$uid
Returns
‪int

Definition at line 343 of file ReferenceIndex.php.

◆ getRecordRawCached()

array false TYPO3\CMS\Core\Database\ReferenceIndex::getRecordRawCached ( string  $tableName,
int  $uid 
)
protected

Gets one record from database and stores it in an internal cache (which expires along with object lifecycle) for faster retrieval

Assumption:

  • ‪This method is only used from within delegate methods and so only caches queries generated based on the record being indexed; the query to select origin side record is uncached
  • ‪Origin side records do not change in database while updating the reference index
  • ‪Origin record does not get removed while updating index
  • ‪Relations may change during indexing, which is why only the origin record is cached and all relations are re-process even when repeating indexing of the same origin record

Please note that the cache is disabled by default but can be enabled using $this->enableRuntimeCaches() due to possible side-effects while handling references that were changed during one single request.

Parameters
string$tableName
int$uid
Returns
‪array|false

Definition at line 1302 of file ReferenceIndex.php.

References $GLOBALS, TYPO3\CMS\Core\Database\ReferenceIndex\$relations, TYPO3\CMS\Core\Database\ReferenceIndex\fetchTableRelationFields(), TYPO3\CMS\Backend\Utility\BackendUtility\isTableWorkspaceEnabled(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\createEntryData_dbRels(), TYPO3\CMS\Core\Database\ReferenceIndex\createEntryData_softreferences(), and TYPO3\CMS\Core\Database\ReferenceIndex\updateRefIndexTable().

◆ getRelations()

array TYPO3\CMS\Core\Database\ReferenceIndex::getRelations (   $table,
  $row,
  $onlyField = '' 
)

Returns relation information for a $table/$row-array Traverses all fields in input row which are configured in TCA/columns It looks for hard relations to records in the TCA types "select" and "group"

Parameters
string$table‪Table name
array$row‪Row from table
string$onlyField‪Specific field to fetch for.
Returns
‪array Array with information about relations
See also
‪export_addRecord()

Definition at line 618 of file ReferenceIndex.php.

References $GLOBALS, TYPO3\CMS\Core\Database\ReferenceIndex\$temp_flexRelations, TYPO3\CMS\Backend\Utility\BackendUtility\explodeSoftRefParserList(), TYPO3\CMS\Core\Database\ReferenceIndex\getRelations_procDB(), TYPO3\CMS\Core\Database\ReferenceIndex\shouldExcludeTableColumnFromReferenceIndex(), TYPO3\CMS\Backend\Utility\BackendUtility\softRefParserObj(), and TYPO3\CMS\Core\Utility\GeneralUtility\xml2array().

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\setReferenceValue().

◆ getRelations_flexFormCallBack()

TYPO3\CMS\Core\Database\ReferenceIndex::getRelations_flexFormCallBack (   $dsArr,
  $dataValue,
  $PA,
  $structurePath 
)

Callback function for traversing the FlexForm structure in relation to finding DB references!

Parameters
array$dsArr‪Data structure for the current value
mixed$dataValue‪Current value
array$PA‪Additional configuration used in calling function
string$structurePath‪Path of value in DS structure
See also
DataHandler::checkValue_flex_procInData_travDS()
FlexFormTools::traverseFlexFormXMLData()

Definition at line 698 of file ReferenceIndex.php.

References TYPO3\CMS\Backend\Utility\BackendUtility\explodeSoftRefParserList(), TYPO3\CMS\Core\Database\ReferenceIndex\getRelations_procDB(), and TYPO3\CMS\Backend\Utility\BackendUtility\softRefParserObj().

◆ getRelations_procDB()

array bool TYPO3\CMS\Core\Database\ReferenceIndex::getRelations_procDB (   $value,
  $conf,
  $uid,
  $table = '' 
)

Check field configuration if it is a DB relation field and extract DB relations if any

Parameters
string$value‪Field value
array$conf‪Field configuration array of type "TCA/columns
int$uid‪Field uid
string$table‪Table name
Returns
‪array|bool If field type is OK it will return an array with the database relations. Else FALSE

Definition at line 752 of file ReferenceIndex.php.

References TYPO3\CMS\Core\Database\ReferenceIndex\getWorkspaceId(), and TYPO3\CMS\Core\Database\ReferenceIndex\isDbReferenceField().

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\getRelations(), and TYPO3\CMS\Core\Database\ReferenceIndex\getRelations_flexFormCallBack().

◆ getWorkspaceId()

int TYPO3\CMS\Core\Database\ReferenceIndex::getWorkspaceId ( )

Gets the current workspace id

Returns
‪int
See also
updateRefIndexTable()
createEntryData()

Definition at line 173 of file ReferenceIndex.php.

References TYPO3\CMS\Core\Database\ReferenceIndex\$workspaceId.

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\getRelations_procDB().

◆ isDbReferenceField()

bool TYPO3\CMS\Core\Database\ReferenceIndex::isDbReferenceField ( array  $configuration)
protected

Returns TRUE if the TCA/columns field type is a DB reference field

Parameters
array$configuration‪Config array for TCA/columns field
Returns
‪bool TRUE if DB reference field (group/db or select with foreign-table)

Definition at line 1003 of file ReferenceIndex.php.

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\getRelations_procDB(), and TYPO3\CMS\Core\Database\ReferenceIndex\isReferenceField().

◆ isReferenceField()

bool TYPO3\CMS\Core\Database\ReferenceIndex::isReferenceField ( array  $configuration)

Returns TRUE if the TCA/columns field type is a reference field

Parameters
array$configuration‪Config array for TCA/columns field
Returns
‪bool TRUE if reference field

Definition at line 1020 of file ReferenceIndex.php.

References TYPO3\CMS\Core\Database\ReferenceIndex\isDbReferenceField().

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\fetchTableRelationFields().

◆ removeReferenceIndexDataFromUnusedDatabaseTables()

TYPO3\CMS\Core\Database\ReferenceIndex::removeReferenceIndexDataFromUnusedDatabaseTables ( array  $tableNames)
protected

◆ setReferenceValue()

string bool array TYPO3\CMS\Core\Database\ReferenceIndex::setReferenceValue (   $hash,
  $newValue,
  $returnDataArray = false,
  $bypassWorkspaceAdminCheck = false 
)

Setting the value of a reference or removing it completely. Usage: For lowlevel clean up operations! WARNING: With this you can set values that are not allowed in the database since it will bypass all checks for validity! Hence it is targeted at clean-up operations. Please use DataHandler in the usual ways if you wish to manipulate references. Since this interface allows updates to soft reference values (which DataHandler does not directly) you may like to use it for that as an exception to the warning above. Notice; If you want to remove multiple references from the same field, you MUST start with the one having the highest sorting number. If you don't the removal of a reference with a lower number will recreate an index in which the remaining references in that field has new hash-keys due to new sorting numbers - and you will get errors for the remaining operations which cannot find the hash you feed it! To ensure proper working only admin-BE_USERS in live workspace should use this function

Parameters
string$hash‪32-byte hash string identifying the record from sys_refindex which you wish to change the value for
mixed$newValue‪Value you wish to set for reference. If NULL, the reference is removed (unless a soft-reference in which case it can only be set to a blank string). If you wish to set a database reference, use the format "[table]:[uid]". Any other case, the input value is set as-is
bool$returnDataArray‪Return $dataArray only, do not submit it to database.
bool$bypassWorkspaceAdminCheck‪If set, it will bypass check for workspace-zero and admin user
Returns
‪string|bool|array FALSE (=OK), error message string or array (if $returnDataArray is set!)

Definition at line 803 of file ReferenceIndex.php.

References $GLOBALS, TYPO3\CMS\Core\Database\ReferenceIndex\getBackendUser(), TYPO3\CMS\Core\Database\ReferenceIndex\getRelations(), TYPO3\CMS\Core\Database\ReferenceIndex\setReferenceValue_dbRels(), and TYPO3\CMS\Core\Database\ReferenceIndex\setReferenceValue_softreferences().

◆ setReferenceValue_dbRels()

string TYPO3\CMS\Core\Database\ReferenceIndex::setReferenceValue_dbRels (   $refRec,
  $itemArray,
  $newValue,
$dataArray,
  $flexPointer = '' 
)

Setting a value for a reference for a DB field:

Parameters
array$refRec‪sys_refindex record
array$itemArray‪Array of references from that field
string$newValue‪Value to substitute current value with (or NULL to unset it)
array$dataArray‪Data array in which the new value is set (passed by reference)
string$flexPointer‪Flexform pointer, if in a flex form field.
Returns
‪string Error message if any, otherwise FALSE = OK

Definition at line 921 of file ReferenceIndex.php.

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\setReferenceValue().

◆ setReferenceValue_softreferences()

string TYPO3\CMS\Core\Database\ReferenceIndex::setReferenceValue_softreferences (   $refRec,
  $softref,
  $newValue,
$dataArray,
  $flexPointer = '' 
)

Setting a value for a soft reference token

Parameters
array$refRec‪sys_refindex record
array$softref‪Array of soft reference occurrences
string$newValue‪Value to substitute current value with
array$dataArray‪Data array in which the new value is set (passed by reference)
string$flexPointer‪Flexform pointer, if in a flex form field.
Returns
‪string Error message if any, otherwise FALSE = OK

Definition at line 961 of file ReferenceIndex.php.

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\setReferenceValue().

◆ setWorkspaceId()

TYPO3\CMS\Core\Database\ReferenceIndex::setWorkspaceId (   $workspaceId)

Sets the current workspace id

Parameters
int$workspaceId
See also
updateIndex()

Definition at line 161 of file ReferenceIndex.php.

References TYPO3\CMS\Core\Database\ReferenceIndex\$workspaceId.

◆ shouldExcludeTableColumnFromReferenceIndex()

bool TYPO3\CMS\Core\Database\ReferenceIndex::shouldExcludeTableColumnFromReferenceIndex (   $tableName,
  $column,
  $onlyColumn 
)
protected

Checks if a given column in a given table should be excluded in the ReferenceIndex process

Parameters
string$tableName‪Name of the table
string$column‪Name of the column
string$onlyColumn‪Name of a specific column to fetch
Returns
‪bool true if it should be excluded

Definition at line 1386 of file ReferenceIndex.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\getRelations().

◆ shouldExcludeTableFromReferenceIndex()

bool TYPO3\CMS\Core\Database\ReferenceIndex::shouldExcludeTableFromReferenceIndex (   $tableName)
protected

Checks if a given table should be excluded from ReferenceIndex

Parameters
string$tableName‪Name of the table
Returns
‪bool true if it should be excluded

Definition at line 1363 of file ReferenceIndex.php.

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\updateIndex(), and TYPO3\CMS\Core\Database\ReferenceIndex\updateRefIndexTable().

◆ updateIndex()

array TYPO3\CMS\Core\Database\ReferenceIndex::updateIndex (   $testOnly,
  $cli_echo = null 
)

Updating Index (External API)

Parameters
bool$testOnly‪If set, only a test
bool | ProgressListenerInterface | null$cli_echo‪If set, output CLI status - but can now be of type ProgressListenerInterface, which should be used instead.
Returns
‪array Header and body status content

Definition at line 1072 of file ReferenceIndex.php.

References $errors, $fields, $GLOBALS, TYPO3\CMS\Core\Database\ConnectionPool\DEFAULT_CONNECTION_NAME, TYPO3\CMS\Core\Database\ReferenceIndex\getAmountOfUnusedTablesInReferenceIndex(), TYPO3\CMS\Backend\Utility\BackendUtility\isTableWorkspaceEnabled(), TYPO3\CMS\Core\Database\ReferenceIndex\removeReferenceIndexDataFromUnusedDatabaseTables(), and TYPO3\CMS\Core\Database\ReferenceIndex\shouldExcludeTableFromReferenceIndex().

◆ updateRefIndexTable()

array TYPO3\CMS\Core\Database\ReferenceIndex::updateRefIndexTable (   $tableName,
  $uid,
  $testOnly = false 
)

Call this function to update the sys_refindex table for a record (even one just deleted) NOTICE: Currently, references updated for a deleted-flagged record will not include those from within FlexForm fields in some cases where the data structure is defined by another record since the resolving process ignores deleted records! This will also result in bad cleaning up in DataHandler I think... Anyway, that's the story of FlexForms; as long as the DS can change, lots of references can get lost in no time.

Parameters
string$tableName‪Table name
int$uid‪UID of record
bool$testOnly‪If set, nothing will be written to the index but the result value will still report statistics on what is added, deleted and kept. Can be used for mere analysis.
Returns
‪array Array with statistics about how many index records were added, deleted and not altered plus the complete reference set for the record.

Definition at line 190 of file ReferenceIndex.php.

References TYPO3\CMS\Core\Database\ReferenceIndex\$relations, TYPO3\CMS\Core\Database\ReferenceIndex\fetchTableRelationFields(), TYPO3\CMS\Core\Database\ReferenceIndex\generateDataUsingRecord(), TYPO3\CMS\Core\Database\ReferenceIndex\getRecordRawCached(), and TYPO3\CMS\Core\Database\ReferenceIndex\shouldExcludeTableFromReferenceIndex().

Member Data Documentation

◆ $cachePrefixTableRelationFields

string TYPO3\CMS\Core\Database\ReferenceIndex::$cachePrefixTableRelationFields = 'core-refidx-tblRelFields-'
staticprotected

Fields of tables that could contain relations are cached per table. This is the prefix for the cache entries since the runtimeCache has a global scope.

Definition at line 92 of file ReferenceIndex.php.

◆ $eventDispatcher

EventDispatcherInterface TYPO3\CMS\Core\Database\ReferenceIndex::$eventDispatcher
protected

◆ $excludedColumns

array TYPO3\CMS\Core\Database\ReferenceIndex::$excludedColumns
staticprotected
Initial value:
= array(
'uid' => true,
'perms_userid' => true,
'perms_groupid' => true,
'perms_user' => true,
'perms_group' => true,
'perms_everybody' => true,
'pid' => true
)

Definition of fields to exclude from ReferenceIndex in every table

Implemented as array with fields as keys and booleans as values for fast isset() lookup instead of slow in_array()

See also
getRelations()
fetchTableRelationFields()
shouldExcludeTableColumnFromReferenceIndex()

Definition at line 77 of file ReferenceIndex.php.

◆ $excludedTables

array TYPO3\CMS\Core\Database\ReferenceIndex::$excludedTables
staticprotected
Initial value:
= array(
'sys_log' => true,
'tx_extensionmanager_domain_model_extension' => true
)

Definition of tables to exclude from the ReferenceIndex

Only tables which do not contain any relations and never did so far since references also won't be deleted for these. Since only tables with an entry in $GLOBALS['TCA] are handled by ReferenceIndex there is no need to add *_mm-tables.

Implemented as array with fields as keys and booleans as values for fast isset() lookup instead of slow in_array()

See also
updateRefIndexTable()
shouldExcludeTableFromReferenceIndex()

Definition at line 63 of file ReferenceIndex.php.

◆ $hashVersion

int TYPO3\CMS\Core\Database\ReferenceIndex::$hashVersion = 1

Number which we can increase if a change in the code means we will have to force a re-generation of the index.

See also
updateRefIndexTable()

Definition at line 123 of file ReferenceIndex.php.

◆ $recordCache

array TYPO3\CMS\Core\Database\ReferenceIndex::$recordCache = array( )
protected

A cache to avoid that identical rows are refetched from the database

See also
getRecordRawCached()

Definition at line 116 of file ReferenceIndex.php.

◆ $relations

array TYPO3\CMS\Core\Database\ReferenceIndex::$relations = array( )

An index of all found references of a single record created in createEntryData() and accumulated in generateRefIndexData()

See also
createEntryData()
generateRefIndexData()

Definition at line 109 of file ReferenceIndex.php.

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\getRecordRawCached(), and TYPO3\CMS\Core\Database\ReferenceIndex\updateRefIndexTable().

◆ $runtimeCache

TYPO3 CMS Core Cache Frontend FrontendInterface TYPO3\CMS\Core\Database\ReferenceIndex::$runtimeCache
protected

Runtime Cache to store and retrieve data computed for a single request

Definition at line 135 of file ReferenceIndex.php.

◆ $temp_flexRelations

array TYPO3\CMS\Core\Database\ReferenceIndex::$temp_flexRelations = array( )

This array holds the FlexForm references of a record

See also
getRelations()
FlexFormTools::traverseFlexFormXMLData()
getRelations_flexFormCallBack()

Definition at line 101 of file ReferenceIndex.php.

Referenced by TYPO3\CMS\Core\Database\ReferenceIndex\getRelations().

◆ $useRuntimeCache

bool TYPO3\CMS\Core\Database\ReferenceIndex::$useRuntimeCache = false
protected

Enables $runtimeCache and $recordCache

Definition at line 140 of file ReferenceIndex.php.

◆ $workspaceId

int TYPO3\CMS\Core\Database\ReferenceIndex::$workspaceId = 0
protected