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

Public Member Functions

array 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)
array getPageIdArray ()
array getCheckGroupDBRefs ()
array getCheckSelectDBRefs ()
array getRecStats ()
array getLRecords ()
string 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 40 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 293 of file DatabaseIntegrityCheck.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\GeneralUtility\intExplode().

◆ 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$tableDatabase 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 269 of file DatabaseIntegrityCheck.php.

References $GLOBALS.

◆ 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 108 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 175 of file DatabaseIntegrityCheck.php.

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

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

◆ getCheckGroupDBRefs()

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

◆ getCheckSelectDBRefs()

array 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 350 of file DatabaseIntegrityCheck.php.

References $GLOBALS.

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

◆ getLostPagesList()

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

◆ getLRecords()

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

Definition at line 568 of file DatabaseIntegrityCheck.php.

References TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck\$lRecords.

◆ getPageIdArray()

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

◆ getPageTranslatedPageIDArray()

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

◆ getRecStats()

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

Definition at line 560 of file DatabaseIntegrityCheck.php.

References TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck\$recStats.

◆ 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 218 of file DatabaseIntegrityCheck.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\GeneralUtility\intExplode().

◆ 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 493 of file DatabaseIntegrityCheck.php.

References $GLOBALS.

Member Data Documentation

◆ $checkGroupDBRefs

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

From the group-fields

Definition at line 75 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 71 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 44 of file DatabaseIntegrityCheck.php.

◆ $genTreeIncludeRecords

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

If set, genTree() includes records from pages.

Definition at line 53 of file DatabaseIntegrityCheck.php.

◆ $genTreeIncludeVersions

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

Definition at line 49 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 67 of file DatabaseIntegrityCheck.php.

◆ $recStats

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


Definition at line 79 of file DatabaseIntegrityCheck.php.

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