DatabaseIntegrityCheck

class \TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck

This class holds functions used by the TYPO3 backend to check the integrity of the database (The DBint module, 'lowlevel' extension)

Depends on \TYPO3\CMS\Core\Database\RelationHandler

Tags

TODO:

Need to really extend this class when the DataHandler library has been

TODO:

updated and the whole API is better defined. There are some known bugs

TODO:

in this library. Further it would be nice with a facility to not only

TODO:

analyze but also clean up!

see
DatabaseIntegrityController::relationsAction()
see
DatabaseIntegrityController::recordStatisticsAction()

Attributes

#[Autoconfigure]
$public: true

Table of Contents

Properties

$checkGroupDBRefs  : array
$checkSelectDBRefs  : array
$lostPagesList  : string
$lRecords  : array
$pageIdArray  : array
$pageTranslatedPageIDArray  : array
$recStats  : array
$tcaSchemaFactory  : TcaSchemaFactory

Methods

__construct()  : mixed
countRecords()  : array
Counts records from $GLOBALS['TCA']-tables that ARE attached to an existing page.
fixLostRecord()  : bool
Fixes lost record from $table with uid $uid by setting the PID to zero.
genTree()  : mixed
Generates a list of Page-uid's that corresponds to the tables in the tree.
getCheckGroupDBRefs()  : array
getCheckSelectDBRefs()  : array
getGroupFields()  : array
Finding relations in database based on type 'group' (database-uid's in a list)
getLostPagesList()  : string
getLRecords()  : array
getPageIdArray()  : array
getPageTranslatedPageIDArray()  : array
getRecStats()  : array
lostRecords()  : void
Fills $this->lRecords with the records from all tc-tables that are not attached to a PID in the pid-list.
selectNonEmptyRecordsWithFkeys()  : void
This selects non-empty-records from the tables/fields in the fkey_array generated by getGroupFields()
testDBRefs()  : string
Depends on selectNonEmpty.... to be executed first!!

Properties

$checkGroupDBRefs

protected array $checkGroupDBRefs = []

From the group-fields

$checkSelectDBRefs

protected array $checkSelectDBRefs = []

From the select-fields

$lostPagesList

protected string $lostPagesList = ''

$pageIdArray

protected array $pageIdArray = []

Will hold id/rec pairs from genTree()

$pageTranslatedPageIDArray

protected array $pageTranslatedPageIDArray = []

Will hold id/rec pairs from genTree() that are not default language

$recStats

protected array $recStats = ['all_valid' => [], 'published_versions' => [], 'deleted' => []]

Statistics

Methods

countRecords()

Counts records from $GLOBALS['TCA']-tables that ARE attached to an existing page.

public countRecords(string $pid_list) : array

Parameters

$pid_list : string

list of pid's (page-record uid's). This list is probably made by genTree()

Return values

array —

an array with the number of records from all $GLOBALS['TCA']-tables that are attached to a PID in the pid-list.

fixLostRecord()

Fixes lost record from $table with uid $uid by setting the PID to zero.

public fixLostRecord(string $table, int $uid) : bool

If there is a disabled column for the record that will be set as well.

Parameters

$table : string

Database tablename

$uid : int

The uid of the record which will have the PID value set to 0 (zero)

Return values

bool —

TRUE if done.

genTree()

Generates a list of Page-uid's that corresponds to the tables in the tree.

public genTree(int $theID[, bool $versions = false ]) : mixed

This list should ideally include all records in the pages-table.

Parameters

$theID : int

a pid (page-record id) from which to start making the tree

$versions : bool = false

Internal variable, don't set from outside!

getCheckGroupDBRefs()

public getCheckGroupDBRefs() : array

Return values

array

getCheckSelectDBRefs()

public getCheckSelectDBRefs() : array

Return values

array

getGroupFields()

Finding relations in database based on type 'group' (database-uid's in a list)

public getGroupFields() : array

Return values

array —

An array with all fields listed that somehow are references to other records (foreign-keys)

getLostPagesList()

public getLostPagesList() : string

Return values

string

getLRecords()

public getLRecords() : array

Return values

array

getPageIdArray()

public getPageIdArray() : array

Return values

array

getPageTranslatedPageIDArray()

public getPageTranslatedPageIDArray() : array

Return values

array

getRecStats()

public getRecStats() : array

Return values

array

lostRecords()

Fills $this->lRecords with the records from all tc-tables that are not attached to a PID in the pid-list.

public lostRecords(string $pid_list) : void

Parameters

$pid_list : string

list of pid's (page-record uid's). This list is probably made by genTree()

selectNonEmptyRecordsWithFkeys()

This selects non-empty-records from the tables/fields in the fkey_array generated by getGroupFields()

public selectNonEmptyRecordsWithFkeys() : void

Tags

see
getGroupFields()

testDBRefs()

Depends on selectNonEmpty.... to be executed first!!

public testDBRefs(array $theArray) : string

Parameters

$theArray : array

Table with key/value pairs being table names and arrays with uid numbers

Return values

string —

HTML Error message

On this page