‪TYPO3CMS  11.5
TYPO3\CMS\Lowlevel\Command\LostFilesCommand Class Reference
Inheritance diagram for TYPO3\CMS\Lowlevel\Command\LostFilesCommand:

Public Member Functions

 __construct (ConnectionPool $connectionPool)
 
 configure ()
 

Protected Member Functions

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

Private Attributes

ConnectionPool $connectionPool
 

Detailed Description

Finds files within uploads/ which are not needed anymore

Definition at line 36 of file LostFilesCommand.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Lowlevel\Command\LostFilesCommand::__construct ( ConnectionPool  $connectionPool)

Member Function Documentation

◆ configure()

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

Configure the command by defining the name, options and arguments

Definition at line 50 of file LostFilesCommand.php.

◆ deleteLostFiles()

TYPO3\CMS\Lowlevel\Command\LostFilesCommand::deleteLostFiles ( array  $lostFiles,
bool  $dryRun,
SymfonyStyle  $io 
)
protected

Removes given files from the uploads/ folder

Parameters
array$lostFiles‪Contains the lost files found
bool$dryRun‪if set, the files are just displayed, but not deleted
SymfonyStyle$io‪the IO object for output

Definition at line 279 of file LostFilesCommand.php.

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

◆ execute()

int TYPO3\CMS\Lowlevel\Command\LostFilesCommand::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
‪int

Definition at line 106 of file LostFilesCommand.php.

References $output, TYPO3\CMS\Lowlevel\Command\LostFilesCommand\deleteLostFiles(), TYPO3\CMS\Lowlevel\Command\LostFilesCommand\findLostFiles(), TYPO3\CMS\Core\Core\Bootstrap\initializeBackendAuthentication(), TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode(), and TYPO3\CMS\Lowlevel\Command\LostFilesCommand\updateReferenceIndex().

◆ findLostFiles()

array TYPO3\CMS\Lowlevel\Command\LostFilesCommand::findLostFiles (   $excludedPaths = [],
  $customPaths = '' 
)
protected

Find lost files in uploads/ or custom folder

Parameters
array$excludedPaths‪list of paths to be excluded, can be uploads/pics/
string$customPaths‪list of paths to be checked instead of uploads/
Returns
‪array an array of files (relative to Environment::getPublicPath()) that are not connected

Definition at line 193 of file LostFilesCommand.php.

References TYPO3\CMS\Core\Core\Environment\getPublicPath(), TYPO3\CMS\Core\Database\Connection\PARAM_STR, and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

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

◆ updateReferenceIndex()

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

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

Member Data Documentation

◆ $connectionPool

ConnectionPool TYPO3\CMS\Lowlevel\Command\LostFilesCommand::$connectionPool
private