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

Public Member Functions

 configure ()
 

Protected Member Functions

int execute (InputInterface $input, OutputInterface $output)
 
 updateReferenceIndex (InputInterface $input, SymfonyStyle $io)
 
array findMultipleReferencedFiles ()
 
 copyMultipleReferencedFiles (array $multipleReferencesToFiles, bool $dryRun, SymfonyStyle $io)
 
string formatReferenceIndexEntryToString (array $record)
 

Detailed Description

Finds files within uploads/ which are used multiple times by relations within the database

Definition at line 37 of file FilesWithMultipleReferencesCommand.php.

Member Function Documentation

◆ configure()

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

Configure the command by defining the name, options and arguments

Definition at line 43 of file FilesWithMultipleReferencesCommand.php.

◆ copyMultipleReferencedFiles()

TYPO3\CMS\Lowlevel\Command\FilesWithMultipleReferencesCommand::copyMultipleReferencedFiles ( array  $multipleReferencesToFiles,
bool  $dryRun,
SymfonyStyle  $io 
)
protected

Copies files which are referenced multiple times and updates the reference index so they are only used once

Parameters
array$multipleReferencesToFiles‪Contains files which have been referenced multiple times
bool$dryRun‪if set, the info is just displayed, but no files are copied nor reference index updated
SymfonyStyle$io‪the IO object for output

Definition at line 204 of file FilesWithMultipleReferencesCommand.php.

References TYPO3\CMS\Core\Utility\PathUtility\basename(), TYPO3\CMS\Core\Utility\PathUtility\dirname(), and TYPO3\CMS\Core\Utility\PathUtility\stripPathSitePrefix().

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

◆ execute()

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

Executes the command to

  • ‪optionally update the reference index (to have clean data)
  • ‪find files within the reference index which are referenced more than once
  • ‪copy these files if –dry-run is not set and update the references accordingly
Parameters
InputInterface$input
OutputInterface$output
Returns
‪int

Definition at line 86 of file FilesWithMultipleReferencesCommand.php.

References $output, TYPO3\CMS\Lowlevel\Command\FilesWithMultipleReferencesCommand\copyMultipleReferencedFiles(), TYPO3\CMS\Lowlevel\Command\FilesWithMultipleReferencesCommand\findMultipleReferencedFiles(), TYPO3\CMS\Core\Core\Bootstrap\initializeBackendAuthentication(), and TYPO3\CMS\Lowlevel\Command\FilesWithMultipleReferencesCommand\updateReferenceIndex().

◆ findMultipleReferencedFiles()

array TYPO3\CMS\Lowlevel\Command\FilesWithMultipleReferencesCommand::findMultipleReferencedFiles ( )
protected

Find files which are referenced multiple times in uploads/ folder

Returns
‪array an array of files and their reference hashes that are referenced multiple times

Definition at line 155 of file FilesWithMultipleReferencesCommand.php.

References TYPO3\CMS\Lowlevel\Command\FilesWithMultipleReferencesCommand\formatReferenceIndexEntryToString(), and TYPO3\CMS\Core\Utility\ArrayUtility\sortByKeyRecursive().

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

◆ formatReferenceIndexEntryToString()

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

Formats a sys_refindex entry to something readable

Parameters
array$record
Returns
‪string

Definition at line 249 of file FilesWithMultipleReferencesCommand.php.

Referenced by TYPO3\CMS\Lowlevel\Command\FilesWithMultipleReferencesCommand\findMultipleReferencedFiles().

◆ updateReferenceIndex()

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

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