Commit 7aff0fc2 authored by Benjamin Franzke's avatar Benjamin Franzke Committed by Benni Mack
Browse files

[TASK] Define ImageService as lowlevel service

As identified in #94491, ImageService may be used
in installtool context and is therefore now
defined as lowlevel service via a service provider,
to ensure its dependencies are always available
in install tool contexts.

Resolves: #94493
Related: #94491
Related: #89892
Releases: master
Change-Id: I76934bb48336adb654a82ec23a9b6a1584c5ced9
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69727


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent bb831f22
......@@ -43,11 +43,11 @@ class ImageService implements SingletonInterface
/**
* ImageService constructor.
*
* @param ResourceFactory|null $resourceFactory
* @param ResourceFactory $resourceFactory
*/
public function __construct(ResourceFactory $resourceFactory = null)
public function __construct(ResourceFactory $resourceFactory)
{
$this->resourceFactory = $resourceFactory ?? GeneralUtility::makeInstance(ResourceFactory::class);
$this->resourceFactory = $resourceFactory;
}
/**
......
......@@ -21,6 +21,7 @@ use Psr\Container\ContainerInterface;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Log\LogManager;
use TYPO3\CMS\Core\Package\AbstractServiceProvider;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
/**
......@@ -46,6 +47,7 @@ class ServiceProvider extends AbstractServiceProvider
// @deprecated since v11, will be removed in v12
Service\EnvironmentService::class => [ static::class, 'getEnvironmentService' ],
Service\ExtensionService::class => [ static::class, 'getExtensionService' ],
Service\ImageService::class => [ static::class, 'getImageService' ],
Security\Cryptography\HashService::class => [ static::class, 'getHashService' ],
];
}
......@@ -98,6 +100,13 @@ class ServiceProvider extends AbstractServiceProvider
return $extensionService;
}
public static function getImageService(ContainerInterface $container): Service\ImageService
{
return self::new($container, Service\ImageService::class, [
$container->get(ResourceFactory::class)
]);
}
public static function getHashService(ContainerInterface $container): Security\Cryptography\HashService
{
return self::new($container, Security\Cryptography\HashService::class);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment