LostFilesCommand extends Command

Finds files within uploads/ which are not needed anymore

Table of Contents

Methods

__construct()  : mixed
configure()  : mixed
Configure the command by defining the name, options and arguments
deleteLostFiles()  : mixed
Removes given files from the uploads/ folder
execute()  : int
Executes the command to - optionally update the reference index (to have clean data) - find files within uploads/* which are not connected to the reference index - remove these files if --dry-run is not set
findLostFiles()  : array<string|int, mixed>
Find lost files in uploads/ or custom folder
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

deleteLostFiles()

Removes given files from the uploads/ folder

protected deleteLostFiles(array<string|int, mixed> $lostFiles, bool $dryRun, SymfonyStyle $io) : mixed
Parameters
$lostFiles : array<string|int, mixed>

Contains the lost files found

$dryRun : bool

if set, the files are just displayed, but not deleted

$io : SymfonyStyle

the IO object for output

execute()

Executes the command to - optionally update the reference index (to have clean data) - find files within uploads/* which are not connected to the reference index - remove these files if --dry-run is not set

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

findLostFiles()

Find lost files in uploads/ or custom folder

protected findLostFiles([array<string|int, mixed> $excludedPaths = [] ][, string $customPaths = '' ]) : array<string|int, mixed>
Parameters
$excludedPaths : array<string|int, mixed> = []

list of paths to be excluded, can be uploads/pics/

$customPaths : string = ''

list of paths to be checked instead of uploads/

Return values
array<string|int, mixed>

an array of files (relative to Environment::getPublicPath()) that are not connected

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

Search results