‪TYPO3CMS  10.4
ServiceProvider.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
18 namespace ‪TYPO3\CMS\Install;
19 
20 use Psr\Container\ContainerInterface;
21 use Psr\EventDispatcher\EventDispatcherInterface;
22 use TYPO3\CMS\Core\Configuration\ConfigurationManager;
27 use TYPO3\CMS\Core\DependencyInjection\ContainerBuilder;
35 use ‪TYPO3\CMS\Core\Middleware\NormalizedParamsAttribute as NormalizedParamsMiddleware;
38 use TYPO3\CMS\Core\Package\PackageManager;
44 
49 {
50  protected static function ‪getPackagePath(): string
51  {
52  return __DIR__ . '/../';
53  }
54 
55  public function ‪getFactories(): array
56  {
57  return [
58  Http\Application::class => [ static::class, 'getApplication' ],
59  Http\NotFoundRequestHandler::class => [ static::class, 'getNotFoundRequestHandler' ],
60  Service\ClearCacheService::class => [ static::class, 'getClearCacheService' ],
61  Service\CoreUpdateService::class => [ static::class, 'getCoreUpdateService' ],
62  Service\CoreVersionService::class => [ static::class, 'getCoreVersionService' ],
63  Service\ExtensionConfigurationService::class => [ static::class, 'getExtensionConfigurationService' ],
64  Service\LanguagePackService::class => [ static::class, 'getLanguagePackService' ],
65  Service\LateBootService::class => [ static::class, 'getLateBootService' ],
66  Service\LoadTcaService::class => [ static::class, 'getLoadTcaService' ],
67  Service\SilentConfigurationUpgradeService::class => [ static::class, 'getSilentConfigurationUpgradeService' ],
68  Service\Typo3tempFileService::class => [ static::class, 'getTypo3tempFileService' ],
69  Service\UpgradeWizardsService::class => [ static::class, 'getUpgradeWizardsService' ],
70  Middleware\Installer::class => [ static::class, 'getInstallerMiddleware' ],
71  Middleware\Maintenance::class => [ static::class, 'getMaintenanceMiddleware' ],
72  Controller\EnvironmentController::class => [ static::class, 'getEnvironmentController' ],
73  Controller\IconController::class => [ static::class, 'getIconController' ],
74  Controller\InstallerController::class => [ static::class, 'getInstallerController' ],
75  Controller\LayoutController::class => [ static::class, 'getLayoutController' ],
76  Controller\LoginController::class => [ static::class, 'getLoginController' ],
77  Controller\MaintenanceController::class => [ static::class, 'getMaintenanceController' ],
78  Controller\SettingsController::class => [ static::class, 'getSettingsController' ],
79  Controller\UpgradeController::class => [ static::class, 'getUpgradeController' ],
80  Command\LanguagePackCommand::class => [ static::class, 'getLanguagePackCommand' ],
81  Command\UpgradeWizardRunCommand::class => [ static::class, 'getUpgradeWizardRunCommand' ],
82  Command\UpgradeWizardListCommand::class => [ static::class, 'getUpgradeWizardListCommand' ],
83  Database\PermissionsCheck::class => [ static::class, 'getPermissionsCheck' ],
84  ];
85  }
86 
87  public function ‪getExtensions(): array
88  {
89  return [
90  'backend.routes' => [ static::class, 'configureBackendRoutes' ],
91  CommandRegistry::class => [ static::class, 'configureCommands' ],
92  ];
93  }
94 
95  public static function ‪getApplication(ContainerInterface $container): Http\Application
96  {
97  $requestHandler = $container->get(Http\NotFoundRequestHandler::class);
98  $dispatcher = new ‪MiddlewareDispatcher($requestHandler, [], $container);
99 
100  // Stack of middlewares, executed LIFO
101  $dispatcher->lazy(Middleware\Installer::class);
102  $dispatcher->add($container->get(Middleware\Maintenance::class));
103  $dispatcher->lazy(NormalizedParamsMiddleware::class);
104 
105  return new ‪Http\Application($dispatcher, $container->get(Context::class));
106  }
107 
108  public static function ‪getNotFoundRequestHandler(ContainerInterface $container): Http\NotFoundRequestHandler
109  {
110  return new ‪Http\NotFoundRequestHandler();
111  }
112 
113  public static function ‪getClearCacheService(ContainerInterface $container): Service\ClearCacheService
114  {
115  return new Service\ClearCacheService(
116  $container->get(Service\LateBootService::class),
117  $container->get('cache.di')
118  );
119  }
120 
121  public static function ‪getCoreUpdateService(ContainerInterface $container): Service\CoreUpdateService
122  {
123  return new Service\CoreUpdateService(
124  $container->get(Service\CoreVersionService::class)
125  );
126  }
127 
128  public static function ‪getCoreVersionService(ContainerInterface $container): Service\CoreVersionService
129  {
130  return new Service\CoreVersionService();
131  }
132 
133  public static function ‪getExtensionConfigurationService(ContainerInterface $container): Service\ExtensionConfigurationService
134  {
135  return new Service\ExtensionConfigurationService(
136  $container->get(PackageManager::class),
137  $container->get(ConstantConfigurationParser::class)
138  );
139  }
140 
141  public static function ‪getLanguagePackService(ContainerInterface $container): Service\LanguagePackService
142  {
143  return new Service\LanguagePackService(
144  $container->get(EventDispatcherInterface::class),
145  $container->get(RequestFactory::class),
146  $container->get(LogManager::class)->getLogger(Service\LanguagePackService::class)
147  );
148  }
149 
150  public static function ‪getLateBootService(ContainerInterface $container): Service\LateBootService
151  {
152  return new Service\LateBootService(
153  $container->get(ContainerBuilder::class),
154  $container
155  );
156  }
157 
158  public static function ‪getLoadTcaService(ContainerInterface $container): Service\LoadTcaService
159  {
160  return new Service\LoadTcaService(
161  $container->get(Service\LateBootService::class)
162  );
163  }
164 
165  public static function ‪getSilentConfigurationUpgradeService(ContainerInterface $container): Service\SilentConfigurationUpgradeService
166  {
167  return new Service\SilentConfigurationUpgradeService(
168  $container->get(ConfigurationManager::class)
169  );
170  }
171  public static function ‪getTypo3tempFileService(ContainerInterface $container): Service\Typo3tempFileService
172  {
173  return new Service\Typo3tempFileService(
174  $container->get(ProcessedFileRepository::class),
175  $container->get(StorageRepository::class)
176  );
177  }
178 
179  public static function ‪getUpgradeWizardsService(ContainerInterface $container): Service\UpgradeWizardsService
180  {
181  return new Service\UpgradeWizardsService();
182  }
183 
184  public static function ‪getInstallerMiddleware(ContainerInterface $container): Middleware\Installer
185  {
186  return new ‪Middleware\Installer($container);
187  }
188 
189  public static function ‪getMaintenanceMiddleware(ContainerInterface $container): Middleware\Maintenance
190  {
191  return new ‪Middleware\Maintenance(
192  $container->get(FailsafePackageManager::class),
193  $container->get(ConfigurationManager::class),
194  $container->get(PasswordHashFactory::class),
195  $container
196  );
197  }
198 
199  public static function ‪getEnvironmentController(ContainerInterface $container): Controller\EnvironmentController
200  {
202  $container->get(Service\LateBootService::class)
203  );
204  }
205 
206  public static function ‪getIconController(ContainerInterface $container): Controller\IconController
207  {
208  return new ‪Controller\IconController(
209  $container->get(IconRegistry::class),
210  $container->get(IconFactory::class)
211  );
212  }
213 
214  public static function ‪getInstallerController(ContainerInterface $container): Controller\InstallerController
215  {
217  $container->get(Service\LateBootService::class),
218  $container->get(Service\SilentConfigurationUpgradeService::class),
219  $container->get(ConfigurationManager::class),
220  $container->get(SiteConfiguration::class),
221  $container->get(Registry::class),
222  $container->get(FailsafePackageManager::class),
223  $container->get(PermissionsCheck::class)
224  );
225  }
226 
227  public static function ‪getLayoutController(ContainerInterface $container): Controller\LayoutController
228  {
230  $container->get(Service\SilentConfigurationUpgradeService::class)
231  );
232  }
233 
234  public static function ‪getLoginController(ContainerInterface $container): Controller\LoginController
235  {
236  return new ‪Controller\LoginController();
237  }
238 
239  public static function ‪getMaintenanceController(ContainerInterface $container): Controller\MaintenanceController
240  {
242  $container->get(Service\LateBootService::class),
243  $container->get(Service\ClearCacheService::class),
244  $container->get(Service\Typo3tempFileService::class),
245  $container->get(ConfigurationManager::class),
246  $container->get(PasswordHashFactory::class),
247  $container->get(Locales::class)
248  );
249  }
250 
251  public static function ‪getSettingsController(ContainerInterface $container): Controller\SettingsController
252  {
254  $container->get(PackageManager::class),
255  $container->get(Service\ExtensionConfigurationService::class),
256  $container->get(LanguageServiceFactory::class)
257  );
258  }
259 
260  public static function ‪getUpgradeController(ContainerInterface $container): Controller\UpgradeController
261  {
263  $container->get(PackageManager::class),
264  $container->get(Service\LateBootService::class),
265  $container->get(Service\UpgradeWizardsService::class)
266  );
267  }
268 
269  public static function ‪getLanguagePackCommand(ContainerInterface $container): Command\LanguagePackCommand
270  {
272  'language:update',
273  $container->get(Service\LateBootService::class)
274  );
275  }
276 
277  public static function ‪getUpgradeWizardRunCommand(ContainerInterface $container): Command\UpgradeWizardRunCommand
278  {
280  'upgrade:run',
281  $container->get(Service\LateBootService::class),
282  $container->get(Service\UpgradeWizardsService::class)
283  );
284  }
285 
286  public static function ‪getUpgradeWizardListCommand(ContainerInterface $container): Command\UpgradeWizardListCommand
287  {
289  'upgrade:list',
290  $container->get(Service\LateBootService::class),
291  $container->get(Service\UpgradeWizardsService::class)
292  );
293  }
294 
295  public static function ‪getPermissionsCheck(ContainerInterface $container): Database\‪PermissionsCheck
296  {
297  return new ‪Database\PermissionsCheck();
298  }
299 
300  public static function ‪configureCommands(ContainerInterface $container, ‪CommandRegistry $commandRegistry): ‪CommandRegistry
301  {
302  $commandRegistry->‪addLazyCommand('language:update', Command\LanguagePackCommand::class);
303  $commandRegistry->‪addLazyCommand('upgrade:run', Command\UpgradeWizardRunCommand::class);
304  $commandRegistry->‪addLazyCommand('upgrade:list', Command\UpgradeWizardListCommand::class);
305  return $commandRegistry;
306  }
307 }
‪TYPO3\CMS\Core\Localization\LanguageServiceFactory
Definition: LanguageServiceFactory.php:26
‪TYPO3\CMS\Install\ServiceProvider\getInstallerController
‪static getInstallerController(ContainerInterface $container)
Definition: ServiceProvider.php:214
‪TYPO3\CMS\Core\Resource\ProcessedFileRepository
Definition: ProcessedFileRepository.php:30
‪TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory
Definition: PasswordHashFactory.php:27
‪TYPO3\CMS\Core\Package\AbstractServiceProvider
Definition: AbstractServiceProvider.php:31
‪TYPO3\CMS\Core\Package\FailsafePackageManager
Definition: FailsafePackageManager.php:26
‪TYPO3\CMS\Install\ServiceProvider\getLayoutController
‪static getLayoutController(ContainerInterface $container)
Definition: ServiceProvider.php:227
‪TYPO3\CMS\Install\Middleware\Maintenance
Definition: Maintenance.php:56
‪TYPO3\CMS\Install\Http\Application
Definition: Application.php:34
‪TYPO3\CMS\Install\ServiceProvider\getCoreUpdateService
‪static getCoreUpdateService(ContainerInterface $container)
Definition: ServiceProvider.php:121
‪TYPO3\CMS\Install\Controller\UpgradeController
Definition: UpgradeController.php:80
‪TYPO3\CMS\Install\ServiceProvider\getEnvironmentController
‪static getEnvironmentController(ContainerInterface $container)
Definition: ServiceProvider.php:199
‪TYPO3\CMS\Install\ServiceProvider\getPackagePath
‪static getPackagePath()
Definition: ServiceProvider.php:50
‪TYPO3\CMS\Core\Registry
Definition: Registry.php:33
‪TYPO3\CMS\Install\ServiceProvider\getMaintenanceController
‪static getMaintenanceController(ContainerInterface $container)
Definition: ServiceProvider.php:239
‪TYPO3\CMS\Core\Console\CommandRegistry\addLazyCommand
‪addLazyCommand(string $commandName, string $serviceName, bool $schedulable=true)
Definition: CommandRegistry.php:250
‪TYPO3\CMS\Install\Controller\EnvironmentController
Definition: EnvironmentController.php:53
‪TYPO3\CMS\Install\ServiceProvider\getLanguagePackCommand
‪static getLanguagePackCommand(ContainerInterface $container)
Definition: ServiceProvider.php:269
‪TYPO3\CMS\Install\Http\NotFoundRequestHandler
Definition: NotFoundRequestHandler.php:31
‪TYPO3\CMS\Core\Localization\Locales
Definition: Locales.php:30
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:33
‪TYPO3\CMS\Install\Command\LanguagePackCommand
Definition: LanguagePackCommand.php:36
‪TYPO3\CMS\Install\ServiceProvider\getSettingsController
‪static getSettingsController(ContainerInterface $container)
Definition: ServiceProvider.php:251
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:53
‪TYPO3\CMS\Core\Configuration\SiteConfiguration
Definition: SiteConfiguration.php:41
‪TYPO3\CMS\Install\ServiceProvider\getLoadTcaService
‪static getLoadTcaService(ContainerInterface $container)
Definition: ServiceProvider.php:158
‪TYPO3\CMS\Install\Controller\IconController
Definition: IconController.php:32
‪TYPO3\CMS\Install\ServiceProvider\getUpgradeWizardListCommand
‪static getUpgradeWizardListCommand(ContainerInterface $container)
Definition: ServiceProvider.php:286
‪TYPO3\CMS\Core\Console\CommandRegistry
Definition: CommandRegistry.php:32
‪TYPO3\CMS\Core\Http\MiddlewareDispatcher
Definition: MiddlewareDispatcher.php:35
‪TYPO3\CMS\Install\ServiceProvider\getInstallerMiddleware
‪static getInstallerMiddleware(ContainerInterface $container)
Definition: ServiceProvider.php:184
‪TYPO3\CMS\Install\ServiceProvider\getApplication
‪static getApplication(ContainerInterface $container)
Definition: ServiceProvider.php:95
‪TYPO3\CMS\Core\Middleware\NormalizedParamsAttribute
Definition: NormalizedParamsAttribute.php:33
‪TYPO3\CMS\Install\ServiceProvider\getFactories
‪getFactories()
Definition: ServiceProvider.php:55
‪TYPO3\CMS\Install\ServiceProvider\getUpgradeController
‪static getUpgradeController(ContainerInterface $container)
Definition: ServiceProvider.php:260
‪TYPO3\CMS\Install\Middleware\Installer
Definition: Installer.php:38
‪TYPO3\CMS\Install\ServiceProvider\getMaintenanceMiddleware
‪static getMaintenanceMiddleware(ContainerInterface $container)
Definition: ServiceProvider.php:189
‪TYPO3\CMS\Install\Database\PermissionsCheck
Definition: PermissionsCheck.php:31
‪TYPO3\CMS\Install\Controller\LoginController
Definition: LoginController.php:32
‪TYPO3\CMS\Install\ServiceProvider\getExtensions
‪getExtensions()
Definition: ServiceProvider.php:87
‪TYPO3\CMS\Install\ServiceProvider\getClearCacheService
‪static getClearCacheService(ContainerInterface $container)
Definition: ServiceProvider.php:113
‪TYPO3\CMS\Core\Resource\StorageRepository
Definition: StorageRepository.php:31
‪TYPO3\CMS\Install
‪TYPO3\CMS\Install\ServiceProvider\configureCommands
‪static configureCommands(ContainerInterface $container, CommandRegistry $commandRegistry)
Definition: ServiceProvider.php:300
‪TYPO3\CMS\Core\Imaging\IconRegistry
Definition: IconRegistry.php:38
‪TYPO3\CMS\Install\ServiceProvider\getSilentConfigurationUpgradeService
‪static getSilentConfigurationUpgradeService(ContainerInterface $container)
Definition: ServiceProvider.php:165
‪TYPO3\CMS\Core\Http\RequestFactory
Definition: RequestFactory.php:31
‪TYPO3\CMS\Install\ServiceProvider\getNotFoundRequestHandler
‪static getNotFoundRequestHandler(ContainerInterface $container)
Definition: ServiceProvider.php:108
‪TYPO3\CMS\Install\Controller\LayoutController
Definition: LayoutController.php:39
‪TYPO3\CMS\Install\ServiceProvider
Definition: ServiceProvider.php:49
‪TYPO3\CMS\Install\Controller\InstallerController
Definition: InstallerController.php:74
‪TYPO3\CMS\Install\ServiceProvider\getExtensionConfigurationService
‪static getExtensionConfigurationService(ContainerInterface $container)
Definition: ServiceProvider.php:133
‪TYPO3\CMS\Install\ServiceProvider\getLateBootService
‪static getLateBootService(ContainerInterface $container)
Definition: ServiceProvider.php:150
‪TYPO3\CMS\Install\Command\UpgradeWizardRunCommand
Definition: UpgradeWizardRunCommand.php:43
‪TYPO3\CMS\Install\ServiceProvider\getCoreVersionService
‪static getCoreVersionService(ContainerInterface $container)
Definition: ServiceProvider.php:128
‪TYPO3\CMS\Core\Log\LogManager
Definition: LogManager.php:30
‪TYPO3\CMS\Install\ServiceProvider\getUpgradeWizardsService
‪static getUpgradeWizardsService(ContainerInterface $container)
Definition: ServiceProvider.php:179
‪TYPO3\CMS\Install\ServiceProvider\getIconController
‪static getIconController(ContainerInterface $container)
Definition: ServiceProvider.php:206
‪TYPO3\CMS\Core\TypoScript\Parser\ConstantConfigurationParser
Definition: ConstantConfigurationParser.php:34
‪TYPO3\CMS\Install\Controller\MaintenanceController
Definition: MaintenanceController.php:50
‪TYPO3\CMS\Install\ServiceProvider\getLanguagePackService
‪static getLanguagePackService(ContainerInterface $container)
Definition: ServiceProvider.php:141
‪TYPO3\CMS\Install\Controller\SettingsController
Definition: SettingsController.php:48
‪TYPO3\CMS\Install\ServiceProvider\getLoginController
‪static getLoginController(ContainerInterface $container)
Definition: ServiceProvider.php:234
‪TYPO3\CMS\Install\ServiceProvider\getTypo3tempFileService
‪static getTypo3tempFileService(ContainerInterface $container)
Definition: ServiceProvider.php:171
‪TYPO3\CMS\Install\ServiceProvider\getPermissionsCheck
‪static getPermissionsCheck(ContainerInterface $container)
Definition: ServiceProvider.php:295
‪TYPO3\CMS\Install\Command\UpgradeWizardListCommand
Definition: UpgradeWizardListCommand.php:39
‪TYPO3\CMS\Install\ServiceProvider\getUpgradeWizardRunCommand
‪static getUpgradeWizardRunCommand(ContainerInterface $container)
Definition: ServiceProvider.php:277