Skip to content

Commit

Permalink
REmove cache dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasHermanek committed Nov 18, 2024
1 parent 3b1f682 commit 17d7239
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Domain/Image/Crop/CropCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
use AnzuSystems\CoreDamBundle\Model\Dto\Image\ImageCropDto;
use League\Flysystem\FilesystemException;

final class CropCache
final readonly class CropCache
{
public function __construct(
private readonly FileSystemProvider $fileSystemProvider,
private readonly NameGenerator $nameGenerator,
private FileSystemProvider $fileSystemProvider,
private NameGenerator $nameGenerator,
) {
}

Expand Down Expand Up @@ -69,11 +69,14 @@ public function removeCache(ImageFile $image): void
*/
public function removeCacheByOriginFilePath(string $extSystemSlug, string $path): void
{
$cacheDir = $this->getCacheDir($path);
if (0 === strlen($cacheDir)) {
return;
}

$this->fileSystemProvider
->getCropFilesystemByExtSystemSlug($extSystemSlug)
->deleteDirectory(
$this->getCacheDir($path)
);
->deleteDirectory($cacheDir);
}

private function getCacheDir(string $path): string
Expand Down
2 changes: 2 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
$input->setInteractive(false);
$app->run($input, $output);

return 0;

# Database drop
$input = new ArrayInput([
'command' => 'doctrine:database:drop',
Expand Down

0 comments on commit 17d7239

Please sign in to comment.