‪TYPO3CMS  ‪main
TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck Class Reference

Public Member Functions

 getPageTranslatedPageIDArray ()
 genTree ($theID, $versions=false)
 genTree_records ($theID, $table, $versions=false)
 lostRecords ($pid_list)
bool fixLostRecord ($table, $uid)
array countRecords ($pid_list)
array getGroupFields ()
 selectNonEmptyRecordsWithFkeys ()
string testDBRefs ($theArray)
 getPageIdArray ()
 getCheckGroupDBRefs ()
 getCheckSelectDBRefs ()
 getRecStats ()
 getLRecords ()
 getLostPagesList ()

Protected Attributes

bool $genTreeIncludeDeleted = true
 $genTreeIncludeVersions = true
bool $genTreeIncludeRecords = false
 $pageIdArray = array( )
 $pageTranslatedPageIDArray = array( )
array $recIdArray = array( )
array $checkSelectDBRefs = array( )
array $checkGroupDBRefs = array( )
array $recStats
array $lRecords = array( )
string $lostPagesList = ''

Detailed Description

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

@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 also

Definition at line 42 of file DatabaseIntegrityCheck.php.

Member Function Documentation

◆ countRecords()

array TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::countRecords (   $pid_list)

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

string$pid_list‪list of pid's (page-record uid's). This list is probably made by genTree()
‪array an array with the number of records from all $GLOBALS['TCA']-tables that are attached to a PID in the pid-list.

Definition at line 292 of file DatabaseIntegrityCheck.php.

References $GLOBALS.

◆ fixLostRecord()

bool TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::fixLostRecord (   $table,

Fixes lost record from $table with uid $uid by setting the PID to zero. If there is a disabled column for the record that will be set as well.

string$table‪Database tablename
int$uid‪The uid of the record which will have the PID value set to 0 (zero)
‪bool TRUE if done.

Definition at line 268 of file DatabaseIntegrityCheck.php.

References $GLOBALS, and TYPO3\CMS\Webhooks\Message\$uid.

◆ genTree()

array Will hold id rec pairs from TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::genTree (   $theID,
  $versions = false 

Generates a list of Page-uid's that corresponds to the tables in the tree. This list should ideally include all records in the pages-table.

int$theID‪a pid (page-record id) from which to start making the tree
bool$versions‪Internal variable, don't set from outside!

Definition at line 107 of file DatabaseIntegrityCheck.php.

References $GLOBALS, TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck\genTree_records(), and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

◆ genTree_records()

TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::genTree_records (   $theID,
  $versions = false 
int$theID‪a pid (page-record id) from which to start making the tree
string$table‪Table to get the records from
bool$versions‪Internal variable, don't set from outside!

Definition at line 174 of file DatabaseIntegrityCheck.php.

References TYPO3\CMS\Core\Database\Connection\PARAM_INT.

Referenced by TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck\genTree().

◆ getCheckGroupDBRefs()

TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::getCheckGroupDBRefs ( )

◆ getCheckSelectDBRefs()

TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::getCheckSelectDBRefs ( )

◆ getGroupFields()

array TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::getGroupFields ( )

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

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

Definition at line 349 of file DatabaseIntegrityCheck.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck\selectNonEmptyRecordsWithFkeys().

◆ getLostPagesList()

TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::getLostPagesList ( )

◆ getLRecords()

TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::getLRecords ( )

◆ getPageIdArray()

TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::getPageIdArray ( )

◆ getPageTranslatedPageIDArray()

TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::getPageTranslatedPageIDArray ( )

◆ getRecStats()

TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::getRecStats ( )

◆ lostRecords()

TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::lostRecords (   $pid_list)

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

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

Definition at line 217 of file DatabaseIntegrityCheck.php.

References $GLOBALS.

◆ selectNonEmptyRecordsWithFkeys()

TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::selectNonEmptyRecordsWithFkeys ( )

◆ testDBRefs()

string TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::testDBRefs (   $theArray)

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

array$theArray‪Table with key/value pairs being table names and arrays with uid numbers
‪string HTML Error message

Definition at line 492 of file DatabaseIntegrityCheck.php.

References $GLOBALS, and TYPO3\CMS\Core\Database\Platform\PlatformInformation\getMaxBindParameters().

Member Data Documentation

◆ $checkGroupDBRefs

array TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::$checkGroupDBRefs = array( )

From the group-fields

Definition at line 77 of file DatabaseIntegrityCheck.php.

Referenced by TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck\getCheckGroupDBRefs().

◆ $checkSelectDBRefs

array TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::$checkSelectDBRefs = array( )

From the select-fields

Definition at line 73 of file DatabaseIntegrityCheck.php.

Referenced by TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck\getCheckSelectDBRefs().

◆ $genTreeIncludeDeleted

bool TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::$genTreeIncludeDeleted = true

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

Definition at line 46 of file DatabaseIntegrityCheck.php.

◆ $genTreeIncludeRecords

bool TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::$genTreeIncludeRecords = false

If set, genTree() includes records from pages.

Definition at line 55 of file DatabaseIntegrityCheck.php.

◆ $genTreeIncludeVersions

TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::$genTreeIncludeVersions = true

Definition at line 51 of file DatabaseIntegrityCheck.php.

◆ $lostPagesList

string TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::$lostPagesList = ''

◆ $lRecords

array TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::$lRecords = array( )

◆ $pageIdArray

TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::$pageIdArray = array( )

◆ $pageTranslatedPageIDArray

TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::$pageTranslatedPageIDArray = array( )

◆ $recIdArray

array TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::$recIdArray = array( )

Definition at line 69 of file DatabaseIntegrityCheck.php.

◆ $recStats

array TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::$recStats
Initial value:
= array(
'allValid' => [],
'published_versions' => [],
'deleted' => [],


Definition at line 81 of file DatabaseIntegrityCheck.php.

Referenced by TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck\getRecStats().