Skip to content

Commit

Permalink
Refactor the directory removement
Browse files Browse the repository at this point in the history
  • Loading branch information
lochmueller committed Apr 16, 2024
1 parent 3c0b16a commit 999000d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions Classes/Cache/StaticFileBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ public function flush(): void
$removeService = GeneralUtility::makeInstance(RemoveService::class);
$removeService->subdirectories($absoluteCacheDir);
parent::flush();
$removeService->removeQueueDirectories();
}

/**
Expand Down
9 changes: 6 additions & 3 deletions Classes/Service/RemoveService.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ class RemoveService extends AbstractService
* Finally remove the dirs.
*/
public function __destruct()
{
$this->removeQueueDirectories();
}

public function removeQueueDirectories(): void
{
foreach ($this->removeDirs as $removeDir) {
GeneralUtility::rmdir($removeDir, true);
Expand All @@ -40,8 +45,7 @@ public function file(string $absoulteFileName): bool
}

/**
* Add the subdirecotries of thee given folder to the remove function.
*
* Add the subdirectories of the given folder to the remove function.
*/
public function subdirectories(string $absoluteDirName): self
{
Expand All @@ -62,7 +66,6 @@ public function subdirectories(string $absoluteDirName): self
/**
* Rename the dir and mark them as "to remove".
* Speed up the remove process.
*
*/
public function directory(string $absoluteDirName): self
{
Expand Down

0 comments on commit 999000d

Please sign in to comment.