‪TYPO3CMS  10.4
TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand Class Reference
Inheritance diagram for TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand:

Public Member Functions

 configure ()
 

Protected Member Functions

int execute (InputInterface $input, OutputInterface $output)
 
 updateReferenceIndex (InputInterface $input, SymfonyStyle $io)
 
array findRelationsToNonExistingRecords ()
 
 removeReferencesToMissingRecords (array $offlineVersionRecords, array $nonExistingRecords, bool $dryRun, SymfonyStyle $io)
 
string formatReferenceIndexEntryToString (array $record)
 

Detailed Description

Finds references and soft-references to

  • ‪records which are marked as deleted (e.g. still in the system as reminder)
  • ‪offline versions (references should never point to offline versions)
  • ‪non-existing records (records which have been deleted not via DataHandler)

The later (non-soft-reference variants) can be automatically fixed by simply removing the references from the refindex.

Definition at line 42 of file MissingRelationsCommand.php.

Member Function Documentation

◆ configure()

TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand::configure ( )

Configure the command by defining the name, options and arguments

Definition at line 48 of file MissingRelationsCommand.php.

◆ execute()

int TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand::execute ( InputInterface  $input,
OutputInterface  $output 
)
protected

Executes the command to

  • ‪optionally update the reference index (to have clean data)
  • ‪find data in sys_refindex (softrefs and regular references) where the reference points to a non-existing record or offline version
  • ‪remove these files if –dry-run is not set (not possible for refindexes)
Parameters
InputInterface$input
OutputInterface$output
Returns
‪int

Definition at line 102 of file MissingRelationsCommand.php.

References $output, TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand\findRelationsToNonExistingRecords(), TYPO3\CMS\Core\Core\Bootstrap\initializeBackendAuthentication(), TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand\removeReferencesToMissingRecords(), and TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand\updateReferenceIndex().

◆ findRelationsToNonExistingRecords()

array TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand::findRelationsToNonExistingRecords ( )
protected

Find relations pointing to non-existing records (in managed references or soft-references)

Returns
‪array an array of records within sys_refindex

Definition at line 219 of file MissingRelationsCommand.php.

References $GLOBALS, TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand\formatReferenceIndexEntryToString(), TYPO3\CMS\Backend\Utility\BackendUtility\isTableWorkspaceEnabled(), and TYPO3\CMS\Core\Utility\ArrayUtility\sortByKeyRecursive().

Referenced by TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand\execute().

◆ formatReferenceIndexEntryToString()

string TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand::formatReferenceIndexEntryToString ( array  $record)
protected

Formats a sys_refindex entry to something readable

Parameters
array$record
Returns
‪string

Definition at line 375 of file MissingRelationsCommand.php.

Referenced by TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand\findRelationsToNonExistingRecords().

◆ removeReferencesToMissingRecords()

TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand::removeReferencesToMissingRecords ( array  $offlineVersionRecords,
array  $nonExistingRecords,
bool  $dryRun,
SymfonyStyle  $io 
)
protected

Removes all references to non-existing records or offline versions

Parameters
array$offlineVersionRecords‪Contains the records of offline versions of sys_refindex which need to be removed
array$nonExistingRecords‪Contains the records non-existing records of sys_refindex which need to be removed
bool$dryRun‪if set, the references are just displayed, but not removed
SymfonyStyle$io‪the IO object for output

Definition at line 328 of file MissingRelationsCommand.php.

Referenced by TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand\execute().

◆ updateReferenceIndex()

TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand::updateReferenceIndex ( InputInterface  $input,
SymfonyStyle  $io 
)
protected

Function to update the reference index

  • ‪if the option –update-refindex is set, do it
  • ‪otherwise, if in interactive mode (not having -n set), ask the user
  • ‪otherwise assume everything is fine
Parameters
InputInterface$input‪holds information about entered parameters
SymfonyStyle$io‪necessary for outputting information

Definition at line 191 of file MissingRelationsCommand.php.

Referenced by TYPO3\CMS\Lowlevel\Command\MissingRelationsCommand\execute().