FilesWithMultipleReferencesCommand

class \TYPO3\CMS\Lowlevel\Command\FilesWithMultipleReferencesCommand

Extends
Command

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

Table of Contents

Methods

__construct()  : mixed
configure()  : mixed
Configure the command by defining the name, options and arguments
copyMultipleReferencedFiles()  : mixed
Copies files which are referenced multiple times and updates the reference index so they are only used once
execute()  : int
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
findMultipleReferencedFiles()  : array
Find files which are referenced multiple times in uploads/ folder
formatReferenceIndexEntryToString()  : string
Formats a sys_refindex entry to something readable
updateReferenceIndex()  : mixed
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

Methods

configure()

Configure the command by defining the name, options and arguments

public configure() : mixed

copyMultipleReferencedFiles()

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

protected copyMultipleReferencedFiles(array $multipleReferencesToFiles, bool $dryRun, SymfonyStyle $io) : mixed

Parameters

$multipleReferencesToFiles : array

Contains files which have been referenced multiple times

$dryRun : bool

if set, the info is just displayed, but no files are copied nor reference index updated

$io : SymfonyStyle

the IO object for output

execute()

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

protected execute(InputInterface $input, OutputInterface $output) : int

Parameters

$input : InputInterface
$output : OutputInterface

Return values

int

findMultipleReferencedFiles()

Find files which are referenced multiple times in uploads/ folder

protected findMultipleReferencedFiles() : array

Return values

array —

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

formatReferenceIndexEntryToString()

Formats a sys_refindex entry to something readable

protected formatReferenceIndexEntryToString(array $record) : string

Parameters

$record : array

Return values

string

updateReferenceIndex()

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

protected updateReferenceIndex(InputInterface $input, SymfonyStyle $io) : mixed

Parameters

$input : InputInterface

holds information about entered parameters

$io : SymfonyStyle

necessary for outputting information

On this page