TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
LostFilesCommand Class Reference
Inheritance diagram for LostFilesCommand:

Public Member Functions

 configure ()
 

Protected Member Functions

 execute (InputInterface $input, OutputInterface $output)
 
 updateReferenceIndex (InputInterface $input, SymfonyStyle $io)
 
 findLostFiles ($excludedPaths=[])
 
 deleteLostFiles (array $lostFiles, bool $dryRun, SymfonyStyle $io)
 

Detailed Description

Finds files within uploads/ which are not needed anymore

Definition at line 30 of file LostFilesCommand.php.

Member Function Documentation

configure ( )

Configure the command by defining the name, options and arguments

Definition at line 36 of file LostFilesCommand.php.

deleteLostFiles ( array  $lostFiles,
bool  $dryRun,
SymfonyStyle  $io 
)
protected

Removes given files from the uploads/ folder

Parameters
array$lostFilesContains the lost files found
bool$dryRunif set, the files are just displayed, but not deleted
SymfonyStyle$iothe IO object for output
Returns
void

Definition at line 233 of file LostFilesCommand.php.

References GeneralUtility\getFileAbsFileName().

Referenced by LostFilesCommand\execute().

execute ( InputInterface  $input,
OutputInterface  $output 
)
protected

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
Parameters
InputInterface$input
OutputInterface$output
Returns
void

Definition at line 88 of file LostFilesCommand.php.

References LostFilesCommand\deleteLostFiles(), LostFilesCommand\findLostFiles(), GeneralUtility\trimExplode(), and LostFilesCommand\updateReferenceIndex().

findLostFiles (   $excludedPaths = [])
protected

Find lost files in uploads/ folder

Parameters
array$excludedPathslist of paths to be excluded, can be uploads/pics/
Returns
array an array of files (relative to PATH_site) that are not connected

Definition at line 158 of file LostFilesCommand.php.

References GeneralUtility\getAllFilesAndFoldersInPath(), GeneralUtility\isFirstPartOfStr(), GeneralUtility\makeInstance(), and GeneralUtility\removePrefixPathFromList().

Referenced by LostFilesCommand\execute().

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$inputholds information about entered parameters
SymfonyStyle$ionecessary for outputting information
Returns
void

Definition at line 132 of file LostFilesCommand.php.

References GeneralUtility\makeInstance().

Referenced by LostFilesCommand\execute().