Skip to content

Commit

Permalink
change some definitions (fixes #23)
Browse files Browse the repository at this point in the history
  • Loading branch information
bennyborn committed Jan 20, 2025
1 parent 47dc346 commit 99234a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ Installation & Configuration
Commands
---

Recursively sanitize all files and folders in a given directory
Recursively sanitize all files and folders in a given directory.

```sh
contao-console contao:proper-filenames:sanitize myfolder -r
```

The extension only analyses files that are stored in Contao's DBFS (tl_files). The DBFS should be synchronised
before the call - either via the File manager in the backend or with the following console call:
The extension only analyzes files that are stored in Contao's DBAFS (tl_files). The DBAFS should be synchronized
before the call - either via the `File manager` in the Backend or with the following console call:

```sh
contao-console contao:filesync
Expand Down
26 changes: 13 additions & 13 deletions src/Command/CleanFilesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

#[AsCommand(
name: 'contao:proper-filenames:sanitize',
description: 'Sanitizes the file and folder names of the given path inside contao files folder.',
description: 'Sanitizes the file and folder names of the given path inside Contao`s files folder.',
)]
class CleanFilesCommand extends Command implements FrameworkAwareInterface {

Expand Down Expand Up @@ -79,18 +79,18 @@ public function __construct( string $projectDir, string $uploadPath, Filesystem
protected function configure(): void {

$this
->addArgument('path', InputArgument::REQUIRED, 'Path for what will be cleaned.')
->addArgument('path', InputArgument::REQUIRED, 'Path for what will be sanitized.')

->addOption('folders-only', null, InputOption::VALUE_NONE, 'Only clean folders.')
->addOption('files-only', null, InputOption::VALUE_NONE, 'Only clean files.')
->addOption('recursive', 'r', InputOption::VALUE_NONE, 'Clean path recursively')
->addOption('folders-only', null, InputOption::VALUE_NONE, 'Only sanitize folders.')
->addOption('files-only', null, InputOption::VALUE_NONE, 'Only sanitize files.')
->addOption('recursive', 'r', InputOption::VALUE_NONE, 'Sanitize path recursively')
->addOption('max-depth', 'd', InputOption::VALUE_OPTIONAL, 'Only scan folder up to this depth.', -1)
->addOption('dry-run', null, InputOption::VALUE_NONE, 'Show current and new name of the file or folder without changeing anything.')
->addOption('dry-run', null, InputOption::VALUE_NONE, 'Show current and new name of the file or folder without changing anything.')

->setHelp(
'Be careful this action cannot easily be reversed!'. "\n" .
'Files and Folders not synced to contao will not be cleaned!'. "\n" .
'This command will respect the settings like "excludeFileExtensions", "doNotTrimFilenames", "doNotSanitize", ... for all files and folders it discovers and clean them accordingly.'
'Files and folders not synced to DBAFS will not be sanitized!'. "\n" .
'This command will respect the settings like "excludeFileExtensions", "doNotTrimFilenames", "doNotSanitize", ... for all files and folders it discovers and sanitize them accordingly.'
)
;
}
Expand Down Expand Up @@ -153,15 +153,15 @@ protected function execute( InputInterface $input, OutputInterface $output ): in

if( !$optNoInteraction ) {

$io->section('Cleaning path "' . $filesPath . '"');
$io->section('Sanitizing path "' . $filesPath . '"');

$io->writeln(' * Found folders: ' . $countDirs);
$io->writeln(' * Found files: ' . $countFiles);
}

if( $countFiles === 0 && $countDirs === 0 ) {

$io->success("Nothing found for cleaning.");
$io->success("Nothing found to sanitize.");
return Command::SUCCESS;
}

Expand All @@ -172,7 +172,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in

} else {

if( !$optNoInteraction && !$io->confirm('Execute cleaning files?') ) {
if( !$optNoInteraction && !$io->confirm('Execute sanitizing files?') ) {
return Command::SUCCESS;
}

Expand Down Expand Up @@ -272,11 +272,11 @@ protected function execute( InputInterface $input, OutputInterface $output ): in
$table->render();

$io->writeln(' Total renames files: '. $countFiles .' | folders: '. $countDirs);
$io->success("Cleaning done.");
$io->success("Sanitization done.");

} else {

$io->success("Nothing found for cleaning.");
$io->success("Nothing found for sanitize.");
}

return Command::SUCCESS;
Expand Down

0 comments on commit 99234a5

Please sign in to comment.