‪TYPO3CMS  10.4
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
‪\TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController::func_relations()
‪\TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController::func_records()

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.

Parameters
string$pid_list‪list of pid's (page-record uid's). This list is probably made by genTree()
Returns
‪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, TYPO3\CMS\Core\Utility\GeneralUtility\intExplode(), and TYPO3\CMS\Backend\Utility\BackendUtility\isTableWorkspaceEnabled().

◆ fixLostRecord()

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

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.

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

Definition at line 268 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.

Parameters
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, and TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck\genTree_records().

◆ genTree_records()

TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck::genTree_records (   $theID,
  $table,
  $versions = false 
)
Parameters
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 171 of file DatabaseIntegrityCheck.php.

References TYPO3\CMS\Backend\Utility\BackendUtility\getCommonSelectFields(), and TYPO3\CMS\Backend\Utility\BackendUtility\isTableWorkspaceEnabled().

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)

Returns
‪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()

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

◆ getLRecords()

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

Definition at line 556 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 ( )
Returns
‪array

Definition at line 548 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.

Parameters
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, TYPO3\CMS\Backend\Utility\BackendUtility\getRecordTitle(), TYPO3\CMS\Core\Utility\GeneralUtility\intExplode(), and TYPO3\CMS\Backend\Utility\BackendUtility\isTableWorkspaceEnabled().

◆ selectNonEmptyRecordsWithFkeys()

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

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

See also
getGroupFields()

Definition at line 371 of file DatabaseIntegrityCheck.php.

References $fields, $GLOBALS, TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck\getGroupFields(), and TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder\GT.

◆ testDBRefs()

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

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

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

Definition at line 481 of file DatabaseIntegrityCheck.php.

References $GLOBALS.

Member Data Documentation

◆ $checkGroupDBRefs

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

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( )
protected

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
protected

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
protected

If set, genTree() includes records from pages.

Definition at line 53 of file DatabaseIntegrityCheck.php.

◆ $genTreeIncludeVersions

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

Definition at line 49 of file DatabaseIntegrityCheck.php.

◆ $lostPagesList

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

◆ $lRecords

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

◆ $pageIdArray

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

◆ $pageTranslatedPageIDArray

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

◆ $recIdArray

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

Definition at line 67 of file DatabaseIntegrityCheck.php.

◆ $recStats

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

Statistics

Definition at line 79 of file DatabaseIntegrityCheck.php.

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