|
10 | 10 | use TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface; |
11 | 11 | use TYPO3\CMS\Core\Cache\Backend\TransientBackendInterface; |
12 | 12 | use TYPO3\CMS\Core\Cache\Exception\InvalidDataException; |
| 13 | +use TYPO3\CMS\Core\Information\Typo3Version; |
13 | 14 | use TYPO3\CMS\Core\Resource\ResourceFactory; |
14 | 15 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
15 | 16 | use TYPO3\CMS\Core\Utility\PathUtility; |
@@ -56,7 +57,7 @@ public function setHashLength(int $hashLength): void |
56 | 57 | * Saves data in the cache. |
57 | 58 | * |
58 | 59 | * @param string $entryIdentifier An identifier for this specific cache entry |
59 | | - * @param string $data The data to be stored |
| 60 | + * @param string|mixed $data The data to be stored |
60 | 61 | * @param array $tags Tags to associate with this cache entry. If the backend does not support tags, this option can be ignored. |
61 | 62 | * @param int $lifetime Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime. |
62 | 63 | * |
@@ -259,7 +260,14 @@ protected function getFileName(string $entryIdentifier): string |
259 | 260 | } |
260 | 261 |
|
261 | 262 | try { |
262 | | - $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class); |
| 263 | + if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 14) { |
| 264 | + /** @var ResourceFactory $resourceFactory */ |
| 265 | + $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class); |
| 266 | + } else { |
| 267 | + /** @var StorageRepository $resourceFactory */ |
| 268 | + $resourceFactory = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\StorageRepository::class); |
| 269 | + } |
| 270 | + |
263 | 271 | $storage = $resourceFactory->getDefaultStorage(); |
264 | 272 | $baseName = (string) $storage->sanitizeFileName($baseName); |
265 | 273 | } catch (\Exception $exception) { |
|
0 commit comments