Skip to content

Commit

Permalink
- renamed command
Browse files Browse the repository at this point in the history
- updated README
  • Loading branch information
bennyborn committed Nov 28, 2024
1 parent 331e116 commit b448fd0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,25 @@ Sanitizes the filenames of files uploaded via the Contao file manager or Contao
System requirements
--

* [Contao 4.9 or newer](/~https://github.com/contao/contao)
* [Contao 4.13 or newer](/~https://github.com/contao/contao)


Installation & Configuration
--

* Install via Contao Manager or Composer (`composer require numero2/contao-proper-filenames`)
* In the Backend go to `System Settings` and click `Check filenames` under `Upload settings`
* Configure how the filenames should be renamed by choosing an option from `Valid filename characters`
* 💥 New in v.2.1.0: You can define a list of file extensions that will not be renamed automatically
* 💥 New in v.2.1.0: While editing a folder in the `File manager` you can now choose to not rename files and folders located in a specific folder
* Configure how the filenames should be renamed by choosing an option from `Valid filename characters`


Commands
---

Recursively sanitize all files and folders in a given directory

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

To get a preview of how everything will be renamed there is also a `--dry-run` flag.
For all available flags and options see the help using `contao-console contao:proper-filenames:sanitize --help`.
10 changes: 5 additions & 5 deletions src/Command/CleanFilesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
use Contao\CoreBundle\Framework\FrameworkAwareInterface;
use Contao\CoreBundle\Framework\FrameworkAwareTrait;
use Contao\Dbafs;
use Contao\FilesModel;
use Contao\Files;
use Contao\FilesModel;
use Contao\Folder;
use Doctrine\DBAL\Connection;
use numero2\ProperFilenamesBundle\Util\FilenamesUtil;
Expand All @@ -38,8 +38,8 @@


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

Expand Down Expand Up @@ -143,7 +143,6 @@ protected function execute( InputInterface $input, OutputInterface $output ): in
, 'level' => 0
]);


$countFiles = 0;
$countDirs = 0;

Expand Down Expand Up @@ -366,7 +365,8 @@ private function findSubPaths( array $entry, array $flags ): array {
if( $flags['recursive'] ) {
if( $entry['type'] === 'folder' ) {

$children = Folder::scan($path);
$children = Folder::scan( Path::join($this->projectDir, $path));

$flags['level'] += 1;

foreach( $children as $file ) {
Expand Down

0 comments on commit b448fd0

Please sign in to comment.