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<string|int, mixed>
- 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
__construct()
public
__construct(ConnectionPool $connectionPool, BasicFileUtility $basicFileUtility) : mixed
Parameters
- $connectionPool : ConnectionPool
- $basicFileUtility : BasicFileUtility
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<string|int, mixed> $multipleReferencesToFiles, bool $dryRun, SymfonyStyle $io) : mixed
Parameters
- $multipleReferencesToFiles : array<string|int, mixed>
-
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
intfindMultipleReferencedFiles()
Find files which are referenced multiple times in uploads/ folder
protected
findMultipleReferencedFiles() : array<string|int, mixed>
Return values
array<string|int, mixed> —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<string|int, mixed> $record) : string
Parameters
- $record : array<string|int, mixed>
Return values
stringupdateReferenceIndex()
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