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

Public Member Functions

 configure ()
 

Protected Member Functions

int execute (InputInterface $input, OutputInterface $output)
 
 updateReferenceIndex (InputInterface $input, SymfonyStyle $io)
 
array findMissingReferencedFiles ()
 
array findMissingSoftReferencedFiles ()
 
string getFileNameWithoutAnchor (string $fileName)
 
 removeReferencesToMissingFiles (array $missingManagedFiles, bool $dryRun, SymfonyStyle $io)
 
string formatReferenceIndexEntryToString (array $record)
 

Detailed Description

Finds files which are referenced by TYPO3 but not found in the file system

Definition at line 35 of file MissingFilesCommand.php.

Member Function Documentation

◆ configure()

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

Configure the command by defining the name, options and arguments

Definition at line 41 of file MissingFilesCommand.php.

◆ execute()

int TYPO3\CMS\Lowlevel\Command\MissingFilesCommand::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 actual file does not exist (anymore)
  • ‪remove these files if –dry-run is not set (not possible for refindexes)
Parameters
InputInterface$input
OutputInterface$output
Returns
‪int

Definition at line 87 of file MissingFilesCommand.php.

References $output, TYPO3\CMS\Lowlevel\Command\MissingFilesCommand\findMissingReferencedFiles(), TYPO3\CMS\Lowlevel\Command\MissingFilesCommand\findMissingSoftReferencedFiles(), TYPO3\CMS\Core\Core\Bootstrap\initializeBackendAuthentication(), TYPO3\CMS\Lowlevel\Command\MissingFilesCommand\removeReferencesToMissingFiles(), and TYPO3\CMS\Lowlevel\Command\MissingFilesCommand\updateReferenceIndex().

◆ findMissingReferencedFiles()

array TYPO3\CMS\Lowlevel\Command\MissingFilesCommand::findMissingReferencedFiles ( )
protected

Find file references that points to non-existing files in system Fix methods: API in \TYPO3\CMS\Core\Database\ReferenceIndex that allows to change the value of a reference (or remove it)

Returns
‪array an array of records within sys_refindex

Definition at line 161 of file MissingFilesCommand.php.

References TYPO3\CMS\Lowlevel\Command\MissingFilesCommand\formatReferenceIndexEntryToString(), TYPO3\CMS\Lowlevel\Command\MissingFilesCommand\getFileNameWithoutAnchor(), and TYPO3\CMS\Core\Core\Environment\getPublicPath().

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

◆ findMissingSoftReferencedFiles()

array TYPO3\CMS\Lowlevel\Command\MissingFilesCommand::findMissingSoftReferencedFiles ( )
protected

Find file references that points to non-existing files in system registered as soft references (checked for "softref_key")

Returns
‪array an array of the data within soft references

Definition at line 194 of file MissingFilesCommand.php.

References TYPO3\CMS\Lowlevel\Command\MissingFilesCommand\formatReferenceIndexEntryToString(), TYPO3\CMS\Lowlevel\Command\MissingFilesCommand\getFileNameWithoutAnchor(), and TYPO3\CMS\Core\Core\Environment\getPublicPath().

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

◆ formatReferenceIndexEntryToString()

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

Formats a sys_refindex entry to something readable

Parameters
array$record
Returns
‪string

Definition at line 266 of file MissingFilesCommand.php.

Referenced by TYPO3\CMS\Lowlevel\Command\MissingFilesCommand\findMissingReferencedFiles(), and TYPO3\CMS\Lowlevel\Command\MissingFilesCommand\findMissingSoftReferencedFiles().

◆ getFileNameWithoutAnchor()

string TYPO3\CMS\Lowlevel\Command\MissingFilesCommand::getFileNameWithoutAnchor ( string  $fileName)
protected

Remove a possible anchor like 'my-path/file.pdf#page15'

Parameters
string$fileName‪a filename as found in sys_refindex.ref_string
Returns
‪string the filename but leaving everything behind #page15 behind

Definition at line 226 of file MissingFilesCommand.php.

Referenced by TYPO3\CMS\Lowlevel\Command\MissingFilesCommand\findMissingReferencedFiles(), and TYPO3\CMS\Lowlevel\Command\MissingFilesCommand\findMissingSoftReferencedFiles().

◆ removeReferencesToMissingFiles()

TYPO3\CMS\Lowlevel\Command\MissingFilesCommand::removeReferencesToMissingFiles ( array  $missingManagedFiles,
bool  $dryRun,
SymfonyStyle  $io 
)
protected

Removes all references in the sys_file_reference where files were not found

Parameters
array$missingManagedFiles‪Contains the records of sys_refindex which need to be updated
bool$dryRun‪if set, the references are just displayed, but not removed
SymfonyStyle$io‪the IO object for output

Definition at line 241 of file MissingFilesCommand.php.

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

◆ updateReferenceIndex()

TYPO3\CMS\Lowlevel\Command\MissingFilesCommand::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 131 of file MissingFilesCommand.php.

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