Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Classes/Controller/CleanupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
use TYPO3\CMS\Core\Resource\ResourceStorage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
use TYPO3Fluid\Fluid\View\ViewInterface;
use WebVision\WvFileCleanup\Domain\Repository\FileRepository;

/**
Expand Down
7 changes: 5 additions & 2 deletions Classes/Domain/Repository/FileRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException;
use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\FileInterface;
Expand Down Expand Up @@ -46,7 +47,9 @@ class FileRepository implements SingletonInterface
* @throws ExtensionConfigurationExtensionNotConfiguredException
* @throws ExtensionConfigurationPathDoesNotExistException
*/
public function __construct()
public function __construct(
private readonly IconFactory $iconFactory
)
{
$this->connection = GeneralUtility::makeInstance(ConnectionPool::class);
$this->fileCollectionService = GeneralUtility::makeInstance(FileCollectionService::class);
Expand Down Expand Up @@ -104,7 +107,7 @@ public function findUnusedFile(
});

foreach ($files as $file) {
$return[] = new FileFacade($file);
$return[] = new FileFacade($file, $this->iconFactory);
}

return $return;
Expand Down
22 changes: 9 additions & 13 deletions Classes/FileFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Resource\FileInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
Expand All @@ -37,11 +38,6 @@ class FileFacade
*/
protected static $lastReferenceTimestamps = [];

/**
* @var \TYPO3\CMS\Core\Resource\FileInterface
*/
protected $resource;

/**
* @var \TYPO3\CMS\Core\Database\ConnectionPool
*/
Expand All @@ -53,13 +49,13 @@ class FileFacade
*/
protected $databaseConnection;

/**
* @param \TYPO3\CMS\Core\Resource\FileInterface $resource
*/
public function __construct(\TYPO3\CMS\Core\Resource\FileInterface $resource)
public function __construct(
private readonly FileInterface $resource,
private readonly IconFactory $iconFactory
)
{
$this->resource = $resource;
$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
# $this->resource = $resource;
# $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
}

/**
Expand All @@ -72,7 +68,7 @@ public function getIcon()
}

/**
* @return \TYPO3\CMS\Core\Resource\FileInterface
* @return FileInterface
*/
public function getResource()
{
Expand Down Expand Up @@ -296,7 +292,7 @@ public function __call($method, $arguments)

protected function initDatabaseConnection()
{
$this->queryBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class);
$this->queryBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class);
}

/**
Expand Down