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::func_relations()
see
DatabaseIntegrityController::func_records()

Table of Contents

Properties

$checkGroupDBRefs  : array<string|int, mixed>
$checkSelectDBRefs  : array<string|int, mixed>
$genTreeIncludeDeleted  : bool
$genTreeIncludeRecords  : bool
$genTreeIncludeVersions  : bool
$lostPagesList  : string
$lRecords  : array<string|int, mixed>
$pageIdArray  : array<string|int, mixed>
$pageTranslatedPageIDArray  : array<string|int, mixed>
$recIdArray  : array<string|int, mixed>
$recStats  : array<string|int, mixed>

Methods

countRecords()  : array<string|int, mixed>
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.
genTree_records()  : void
getCheckGroupDBRefs()  : array<string|int, mixed>
getCheckSelectDBRefs()  : array<string|int, mixed>
getGroupFields()  : array<string|int, mixed>
Finding relations in database based on type 'group' (database-uid's in a list)
getLostPagesList()  : string
getLRecords()  : array<string|int, mixed>
getPageIdArray()  : array<string|int, mixed>
getPageTranslatedPageIDArray()  : array<string|int, mixed>
getRecStats()  : array<string|int, mixed>
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<string|int, mixed> $checkGroupDBRefs = []

From the group-fields

$checkSelectDBRefs

protected array<string|int, mixed> $checkSelectDBRefs = []

From the select-fields

$genTreeIncludeDeleted

protected bool $genTreeIncludeDeleted = true

If set, genTree() includes deleted pages. This is default.

$genTreeIncludeRecords

protected bool $genTreeIncludeRecords = false

If set, genTree() includes records from pages.

$genTreeIncludeVersions

protected bool $genTreeIncludeVersions = true

If set, genTree() includes versionized pages/records. This is default.

$lostPagesList

protected string $lostPagesList = ''

$lRecords

protected array<string|int, mixed> $lRecords = []

$pageIdArray

protected array<string|int, mixed> $pageIdArray = []

Will hold id/rec pairs from genTree()

$pageTranslatedPageIDArray

protected array<string|int, mixed> $pageTranslatedPageIDArray = []

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

$recIdArray

protected array<string|int, mixed> $recIdArray = []

$recStats

protected array<string|int, mixed> $recStats = ['allValid' => [], '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<string|int, mixed>
Parameters
$pid_list : string

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

Return values
array<string|int, mixed>

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!

genTree_records()

public genTree_records(int $theID, string $table[, bool $versions = false ]) : void
Parameters
$theID : int

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

$table : string

Table to get the records from

$versions : bool = false

Internal variable, don't set from outside!

getCheckGroupDBRefs()

public getCheckGroupDBRefs() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCheckSelectDBRefs()

public getCheckSelectDBRefs() : array<string|int, mixed>
Return values
array<string|int, mixed>

getGroupFields()

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

public getGroupFields() : array<string|int, mixed>
Return values
array<string|int, mixed>

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<string|int, mixed>
Return values
array<string|int, mixed>

getPageIdArray()

public getPageIdArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPageTranslatedPageIDArray()

public getPageTranslatedPageIDArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRecStats()

public getRecStats() : array<string|int, mixed>
Return values
array<string|int, mixed>

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<string|int, mixed> $theArray) : string
Parameters
$theArray : array<string|int, mixed>

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

Return values
string

HTML Error message


        
On this page

Search results