TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck Class Reference
Inheritance diagram for TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck:
t3lib_admin

Public Member Functions

 genTree ($theID, $depthData, $versions=FALSE)
 
 genTree_records ($theID, $depthData, $table='', $versions=FALSE)
 
 lostRecords ($pid_list)
 
 fixLostRecord ($table, $uid)
 
 countRecords ($pid_list)
 
 getGroupFields ($mode)
 
 getFileFields ($uploadfolder)
 
 getDBFields ($theSearchTable)
 
 testFileRefs ()
 
 testDBRefs ($theArray)
 
 whereIsFileReferenced ($uploadfolder, $filename)
 

Public Attributes

 $genTree_includeDeleted = TRUE
 
 $genTree_includeVersions = TRUE
 
 $genTree_includeRecords = FALSE
 
 $perms_clause = ''
 
 $genTree_makeHTML = 0
 
 $page_idArray = array()
 
 $rec_idArray = array()
 
 $genTree_HTML = ''
 
 $backPath = ''
 
 $checkFileRefs = array()
 
 $checkSelectDBRefs = array()
 
 $checkGroupDBRefs = array()
 
 $recStats
 
 $lRecords = array()
 
 $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: Depends on

Todo:
Need to really extend this class when the tcemain library has been updated and the whole API is better defined. There are some known bugs in this library. Further it would be nice with a facility to not only analyze but also clean up!
See also
SC_mod_tools_dbint_index::func_relations(), SC_mod_tools_dbint_index::func_records()
Author
Kasper Skårhøj kaspe.nosp@m.rYYY.nosp@m.Y@typ.nosp@m.o3.c.nosp@m.om

Definition at line 28 of file DatabaseIntegrityCheck.php.

Member Function Documentation

◆ countRecords()

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::countRecords (   $pid_list)

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

Parameters
string$pid_listlist 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.
Todo:
Define visibility

Definition at line 325 of file DatabaseIntegrityCheck.php.

References $GLOBALS, and TYPO3\CMS\Backend\Utility\BackendUtility\deleteClause().

◆ fixLostRecord()

TYPO3\CMS\Core\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$tableDatabase tablename
integer$uidThe uid of the record which will have the PID value set to 0 (zero)
Returns
boolean TRUE if done.
Todo:
Define visibility

Definition at line 303 of file DatabaseIntegrityCheck.php.

References $GLOBALS, and $uid.

◆ genTree()

string Will hold the HTML code visualising the tree TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::genTree (   $theID,
  $depthData,
  $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
integer$theIDa pid (page-record id) from which to start making the tree
string$depthDataHTML-code (image-tags) used when this function calls itself recursively.
boolean$versionsInternal variable, don't set from outside!
Returns
void
Todo:
Define visibility
Todo:
Define visibility
Todo:
Define visibility
Todo:
Define visibility
Todo:
Define visibility
Todo:
Define visibility
Todo:
Define visibility

Definition at line 136 of file DatabaseIntegrityCheck.php.

References $GLOBALS, TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck\genTree_records(), TYPO3\CMS\Backend\Utility\IconUtility\getSpriteIconForRecord(), and TYPO3\CMS\Backend\Utility\IconUtility\skinImg().

◆ genTree_records()

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::genTree_records (   $theID,
  $depthData,
  $table = '',
  $versions = FALSE 
)
Parameters
integer$theIDa pid (page-record id) from which to start making the tree
string$depthDataHTML-code used when this function calls itself recursively.
string$tableTable to get the records from
boolean$versionsInternal variable, don't set from outside!
Returns
void
Todo:
Define visibility

Definition at line 206 of file DatabaseIntegrityCheck.php.

References $GLOBALS, TYPO3\CMS\Backend\Utility\BackendUtility\deleteClause(), TYPO3\CMS\Backend\Utility\BackendUtility\getCommonSelectFields(), TYPO3\CMS\Backend\Utility\BackendUtility\getRecordTitle(), TYPO3\CMS\Backend\Utility\IconUtility\getSpriteIconForRecord(), and TYPO3\CMS\Backend\Utility\IconUtility\skinImg().

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

◆ getDBFields()

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::getDBFields (   $theSearchTable)

Returns an array with arrays of table/field pairs which are allowed to hold references to the input table name - according to $GLOBALS['TCA']

Parameters
string$theSearchTableTable name
Returns
array
Todo:
Define visibility

Definition at line 403 of file DatabaseIntegrityCheck.php.

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

Referenced by TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck\testDBRefs().

◆ getFileFields()

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::getFileFields (   $uploadfolder)

Finds all fields that hold filenames from uploadfolder

Parameters
string$uploadfolderPath to uploadfolder
Returns
array An array with all fields listed that have references to files in the $uploadfolder
Todo:
Define visibility

Definition at line 383 of file DatabaseIntegrityCheck.php.

References $GLOBALS, and $result.

Referenced by TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck\whereIsFileReferenced().

◆ getGroupFields()

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::getGroupFields (   $mode)

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

Parameters
string$mode$mode = file, $mode = db, $mode = '' (all...)
Returns
array An array with all fields listed that somehow are references to other records (foreign-keys) or files
Todo:
Define visibility

Definition at line 355 of file DatabaseIntegrityCheck.php.

References $GLOBALS, and $result.

◆ lostRecords()

TYPO3\CMS\Core\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_listlist of pid's (page-record uid's). This list is probably made by genTree()
Returns
void
Todo:
Define visibility

Definition at line 267 of file DatabaseIntegrityCheck.php.

References $GLOBALS, and TYPO3\CMS\Backend\Utility\BackendUtility\getRecordTitle().

◆ testDBRefs()

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::testDBRefs (   $theArray)

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

Parameters
array$theArrayTable with key/value pairs being table names and arrays with uid numbers
Returns
string HTML Error message
Todo:
Define visibility

Definition at line 584 of file DatabaseIntegrityCheck.php.

References $GLOBALS, $result, TYPO3\CMS\Backend\Utility\BackendUtility\deleteClause(), TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck\getDBFields(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ testFileRefs()

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::testFileRefs ( )

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

Returns
array Report over files; keys are "moreReferences", "noReferences", "noFile", "error
Todo:
Define visibility

Definition at line 506 of file DatabaseIntegrityCheck.php.

References $GLOBALS, and TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck\whereIsFileReferenced().

◆ whereIsFileReferenced()

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::whereIsFileReferenced (   $uploadfolder,
  $filename 
)

Finding all references to file based on uploadfolder / filename

Parameters
string$uploadfolderUpload folder where file is found
string$filenameFilename to search for
Returns
array Array with other arrays containing information about where references was found
Todo:
Define visibility

Definition at line 653 of file DatabaseIntegrityCheck.php.

References $GLOBALS, and TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck\getFileFields().

Referenced by TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck\testFileRefs().

Member Data Documentation

◆ $backPath

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::$backPath = ''

Definition at line 83 of file DatabaseIntegrityCheck.php.

◆ $checkFileRefs

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::$checkFileRefs = array()

Definition at line 90 of file DatabaseIntegrityCheck.php.

◆ $checkGroupDBRefs

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

Definition at line 102 of file DatabaseIntegrityCheck.php.

◆ $checkSelectDBRefs

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

Definition at line 96 of file DatabaseIntegrityCheck.php.

◆ $genTree_HTML

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::$genTree_HTML = ''

Definition at line 77 of file DatabaseIntegrityCheck.php.

◆ $genTree_includeDeleted

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::$genTree_includeDeleted = TRUE

Definition at line 34 of file DatabaseIntegrityCheck.php.

◆ $genTree_includeRecords

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::$genTree_includeRecords = FALSE

Definition at line 46 of file DatabaseIntegrityCheck.php.

◆ $genTree_includeVersions

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::$genTree_includeVersions = TRUE

Definition at line 40 of file DatabaseIntegrityCheck.php.

◆ $genTree_makeHTML

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::$genTree_makeHTML = 0

Definition at line 58 of file DatabaseIntegrityCheck.php.

◆ $lostPagesList

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::$lostPagesList = ''

Definition at line 124 of file DatabaseIntegrityCheck.php.

◆ $lRecords

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

Definition at line 118 of file DatabaseIntegrityCheck.php.

◆ $page_idArray

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::$page_idArray = array()

Definition at line 65 of file DatabaseIntegrityCheck.php.

◆ $perms_clause

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::$perms_clause = ''

Definition at line 52 of file DatabaseIntegrityCheck.php.

◆ $rec_idArray

TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck::$rec_idArray = array()

Definition at line 71 of file DatabaseIntegrityCheck.php.

◆ $recStats

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

Definition at line 108 of file DatabaseIntegrityCheck.php.