‪TYPO3CMS  11.5
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;
36 use ‪TYPO3\CMS\Core\Middleware\ResponsePropagation as ResponsePropagationMiddleware;
40 use TYPO3\CMS\Core\Package\PackageManager;
45 
50 {
51  protected static function ‪getPackagePath(): string
52  {
53  return __DIR__ . '/../';
54  }
55 
56  public function ‪getFactories(): array
57  {
58  return [
59  Http\Application::class => [ static::class, 'getApplication' ],
60  Http\NotFoundRequestHandler::class => [ static::class, 'getNotFoundRequestHandler' ],
61  Service\ClearCacheService::class => [ static::class, 'getClearCacheService' ],
62  Service\CoreUpdateService::class => [ static::class, 'getCoreUpdateService' ],
63  Service\CoreVersionService::class => [ static::class, 'getCoreVersionService' ],
64  Service\ExtensionConfigurationService::class => [ static::class, 'getExtensionConfigurationService' ],
65  Service\LanguagePackService::class => [ static::class, 'getLanguagePackService' ],
66  Service\LateBootService::class => [ static::class, 'getLateBootService' ],
67  Service\LoadTcaService::class => [ static::class, 'getLoadTcaService' ],
68  Service\SilentConfigurationUpgradeService::class => [ static::class, 'getSilentConfigurationUpgradeService' ],
69  Service\SilentTemplateFileUpgradeService::class => [ static::class, 'getSilentTemplateFileUpgradeService' ],
70  Service\WebServerConfigurationFileService::class => [ static::class, 'getWebServerConfigurationFileService' ],
71  Service\UpgradeWizardsService::class => [ static::class, 'getUpgradeWizardsService' ],
72  Middleware\Installer::class => [ static::class, 'getInstallerMiddleware' ],
73  Middleware\Maintenance::class => [ static::class, 'getMaintenanceMiddleware' ],
74  Controller\EnvironmentController::class => [ static::class, 'getEnvironmentController' ],
75  Controller\IconController::class => [ static::class, 'getIconController' ],
76  Controller\InstallerController::class => [ static::class, 'getInstallerController' ],
77  Controller\LayoutController::class => [ static::class, 'getLayoutController' ],
78  Controller\LoginController::class => [ static::class, 'getLoginController' ],
79  Controller\MaintenanceController::class => [ static::class, 'getMaintenanceController' ],
80  Controller\SettingsController::class => [ static::class, 'getSettingsController' ],
81  Controller\UpgradeController::class => [ static::class, 'getUpgradeController' ],
82  Command\LanguagePackCommand::class => [ static::class, 'getLanguagePackCommand' ],
83  Command\UpgradeWizardRunCommand::class => [ static::class, 'getUpgradeWizardRunCommand' ],
84  Command\UpgradeWizardListCommand::class => [ static::class, 'getUpgradeWizardListCommand' ],
85  Database\PermissionsCheck::class => [ static::class, 'getPermissionsCheck' ],
86  ];
87  }
88 
89  public function ‪getExtensions(): array
90  {
91  return [
92  'backend.routes' => [ static::class, 'configureBackendRoutes' ],
93  'icons' => [ static::class, 'configureIcons' ],
94  CommandRegistry::class => [ static::class, 'configureCommands' ],
95  ];
96  }
97 
98  public static function ‪getApplication(ContainerInterface $container): Http\Application
99  {
100  $requestHandler = $container->get(Http\NotFoundRequestHandler::class);
101  $dispatcher = new ‪MiddlewareDispatcher($requestHandler, [], $container);
102 
103  // Stack of middlewares, executed LIFO
104  $dispatcher->lazy(ResponsePropagationMiddleware::class);
105  $dispatcher->lazy(Middleware\Installer::class);
106  $dispatcher->add($container->get(Middleware\Maintenance::class));
107  $dispatcher->lazy(NormalizedParamsMiddleware::class);
108 
109  return new ‪Http\Application($dispatcher, $container->get(Context::class));
110  }
111 
112  public static function ‪getNotFoundRequestHandler(ContainerInterface $container): Http\NotFoundRequestHandler
113  {
114  return new ‪Http\NotFoundRequestHandler();
115  }
116 
117  public static function ‪getClearCacheService(ContainerInterface $container): Service\ClearCacheService
118  {
119  return new Service\ClearCacheService(
120  $container->get(Service\LateBootService::class),
121  $container->get('cache.di')
122  );
123  }
124 
125  public static function ‪getCoreUpdateService(ContainerInterface $container): Service\CoreUpdateService
126  {
127  return new Service\CoreUpdateService(
128  $container->get(Service\CoreVersionService::class)
129  );
130  }
131 
132  public static function ‪getCoreVersionService(ContainerInterface $container): Service\CoreVersionService
133  {
134  return new Service\CoreVersionService();
135  }
136 
137  public static function ‪getExtensionConfigurationService(ContainerInterface $container): Service\ExtensionConfigurationService
138  {
139  return new Service\ExtensionConfigurationService(
140  $container->get(PackageManager::class),
141  $container->get(ConstantConfigurationParser::class)
142  );
143  }
144 
145  public static function ‪getLanguagePackService(ContainerInterface $container): Service\LanguagePackService
146  {
147  return new Service\LanguagePackService(
148  $container->get(EventDispatcherInterface::class),
149  $container->get(RequestFactory::class),
150  $container->get(LogManager::class)->getLogger(Service\LanguagePackService::class)
151  );
152  }
153 
154  public static function ‪getLateBootService(ContainerInterface $container): Service\LateBootService
155  {
156  return new Service\LateBootService(
157  $container->get(ContainerBuilder::class),
158  $container
159  );
160  }
161 
162  public static function ‪getLoadTcaService(ContainerInterface $container): Service\LoadTcaService
163  {
164  return new Service\LoadTcaService(
165  $container->get(Service\LateBootService::class)
166  );
167  }
168 
169  public static function ‪getSilentConfigurationUpgradeService(ContainerInterface $container): Service\SilentConfigurationUpgradeService
170  {
171  return new Service\SilentConfigurationUpgradeService(
172  $container->get(ConfigurationManager::class)
173  );
174  }
175 
176  public static function ‪getSilentTemplateFileUpgradeService(ContainerInterface $container): Service\SilentTemplateFileUpgradeService
177  {
178  return new Service\SilentTemplateFileUpgradeService(
179  $container->get(WebServerConfigurationFileService::class)
180  );
181  }
182 
183  public static function ‪getWebServerConfigurationFileService(ContainerInterface $container): Service\‪WebServerConfigurationFileService
184  {
185  return ‪self::new($container, Service\WebServerConfigurationFileService::class);
186  }
187 
188  public static function ‪getUpgradeWizardsService(ContainerInterface $container): Service\UpgradeWizardsService
189  {
190  return new Service\UpgradeWizardsService();
191  }
192 
193  public static function ‪getInstallerMiddleware(ContainerInterface $container): Middleware\Installer
194  {
195  return new ‪Middleware\Installer($container);
196  }
197 
198  public static function ‪getMaintenanceMiddleware(ContainerInterface $container): Middleware\Maintenance
199  {
200  return new ‪Middleware\Maintenance(
201  $container->get(FailsafePackageManager::class),
202  $container->get(ConfigurationManager::class),
203  $container->get(PasswordHashFactory::class),
204  $container
205  );
206  }
207 
208  public static function ‪getEnvironmentController(ContainerInterface $container): Controller\EnvironmentController
209  {
211  $container->get(Service\LateBootService::class)
212  );
213  }
214 
215  public static function ‪getIconController(ContainerInterface $container): Controller\IconController
216  {
217  return new ‪Controller\IconController(
218  $container->get(IconRegistry::class),
219  $container->get(IconFactory::class)
220  );
221  }
222 
223  public static function ‪getInstallerController(ContainerInterface $container): Controller\InstallerController
224  {
226  $container->get(Service\LateBootService::class),
227  $container->get(Service\SilentConfigurationUpgradeService::class),
228  $container->get(Service\SilentTemplateFileUpgradeService::class),
229  $container->get(ConfigurationManager::class),
230  $container->get(SiteConfiguration::class),
231  $container->get(Registry::class),
232  $container->get(FailsafePackageManager::class),
233  $container->get(VerifyHostHeader::class),
234  $container->get(PermissionsCheck::class)
235  );
236  }
237 
238  public static function ‪getLayoutController(ContainerInterface $container): Controller\LayoutController
239  {
241  $container->get(Service\SilentConfigurationUpgradeService::class),
242  $container->get(Service\SilentTemplateFileUpgradeService::class)
243  );
244  }
245 
246  public static function ‪getLoginController(ContainerInterface $container): Controller\LoginController
247  {
248  return new ‪Controller\LoginController();
249  }
250 
251  public static function ‪getMaintenanceController(ContainerInterface $container): Controller\MaintenanceController
252  {
254  $container->get(Service\LateBootService::class),
255  $container->get(Service\ClearCacheService::class),
256  $container->get(ConfigurationManager::class),
257  $container->get(PasswordHashFactory::class),
258  $container->get(Locales::class)
259  );
260  }
261 
262  public static function ‪getSettingsController(ContainerInterface $container): Controller\SettingsController
263  {
265  $container->get(PackageManager::class),
266  $container->get(Service\ExtensionConfigurationService::class),
267  $container->get(LanguageServiceFactory::class)
268  );
269  }
270 
271  public static function ‪getUpgradeController(ContainerInterface $container): Controller\UpgradeController
272  {
274  $container->get(PackageManager::class),
275  $container->get(Service\LateBootService::class),
276  $container->get(Service\UpgradeWizardsService::class)
277  );
278  }
279 
280  public static function ‪getLanguagePackCommand(ContainerInterface $container): Command\LanguagePackCommand
281  {
283  'language:update',
284  $container->get(Service\LateBootService::class)
285  );
286  }
287 
288  public static function ‪getUpgradeWizardRunCommand(ContainerInterface $container): Command\UpgradeWizardRunCommand
289  {
291  'upgrade:run',
292  $container->get(Service\LateBootService::class),
293  $container->get(Service\UpgradeWizardsService::class)
294  );
295  }
296 
297  public static function ‪getUpgradeWizardListCommand(ContainerInterface $container): Command\UpgradeWizardListCommand
298  {
300  'upgrade:list',
301  $container->get(Service\LateBootService::class),
302  $container->get(Service\UpgradeWizardsService::class)
303  );
304  }
305 
306  public static function ‪getPermissionsCheck(ContainerInterface $container): Database\‪PermissionsCheck
307  {
308  return new ‪Database\PermissionsCheck();
309  }
310 
311  public static function ‪configureCommands(ContainerInterface $container, ‪CommandRegistry $commandRegistry): ‪CommandRegistry
312  {
313  $commandRegistry->‪addLazyCommand(
314  'language:update',
315  Command\LanguagePackCommand::class,
316  'Update the language files of all activated extensions',
317  false,
318  true
319  );
320  $commandRegistry->‪addLazyCommand(
321  'upgrade:run',
322  Command\UpgradeWizardRunCommand::class,
323  'Run upgrade wizard. Without arguments all available wizards will be run.'
324  );
325  $commandRegistry->‪addLazyCommand(
326  'upgrade:list',
327  Command\UpgradeWizardListCommand::class,
328  'List available upgrade wizards.'
329  );
330  return $commandRegistry;
331  }
332 }
‪TYPO3\CMS\Core\Localization\LanguageServiceFactory
Definition: LanguageServiceFactory.php:25
‪TYPO3\CMS\Install\ServiceProvider\getInstallerController
‪static getInstallerController(ContainerInterface $container)
Definition: ServiceProvider.php:223
‪TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory
Definition: PasswordHashFactory.php:27
‪TYPO3\CMS\Core\Package\AbstractServiceProvider
Definition: AbstractServiceProvider.php:31
‪TYPO3\CMS\Core\Middleware\ResponsePropagation
Definition: ResponsePropagation.php:30
‪TYPO3\CMS\Core\Package\FailsafePackageManager
Definition: FailsafePackageManager.php:27
‪TYPO3\CMS\Install\ServiceProvider\getLayoutController
‪static getLayoutController(ContainerInterface $container)
Definition: ServiceProvider.php:238
‪TYPO3\CMS\Install\Middleware\Maintenance
Definition: Maintenance.php:54
‪TYPO3\CMS\Install\Http\Application
Definition: Application.php:34
‪TYPO3\CMS\Install\ServiceProvider\getCoreUpdateService
‪static getCoreUpdateService(ContainerInterface $container)
Definition: ServiceProvider.php:125
‪TYPO3\CMS\Install\Controller\UpgradeController
Definition: UpgradeController.php:82
‪TYPO3\CMS\Install\ServiceProvider\getEnvironmentController
‪static getEnvironmentController(ContainerInterface $container)
Definition: ServiceProvider.php:208
‪TYPO3\CMS\Install\ServiceProvider\getPackagePath
‪static getPackagePath()
Definition: ServiceProvider.php:51
‪TYPO3\CMS\Core\Registry
Definition: Registry.php:33
‪TYPO3\CMS\Install\ServiceProvider\getMaintenanceController
‪static getMaintenanceController(ContainerInterface $container)
Definition: ServiceProvider.php:251
‪TYPO3\CMS\Install\Controller\EnvironmentController
Definition: EnvironmentController.php:53
‪TYPO3\CMS\Install\ServiceProvider\getLanguagePackCommand
‪static getLanguagePackCommand(ContainerInterface $container)
Definition: ServiceProvider.php:280
‪TYPO3\CMS\Install\Http\NotFoundRequestHandler
Definition: NotFoundRequestHandler.php:31
‪TYPO3\CMS\Core\Package\AbstractServiceProvider\new
‪static mixed new(ContainerInterface $container, string $className, array $constructorArguments=[])
Definition: AbstractServiceProvider.php:130
‪TYPO3\CMS\Core\Localization\Locales
Definition: Locales.php:30
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:34
‪TYPO3\CMS\Install\Command\LanguagePackCommand
Definition: LanguagePackCommand.php:36
‪TYPO3\CMS\Install\ServiceProvider\getSettingsController
‪static getSettingsController(ContainerInterface $container)
Definition: ServiceProvider.php:262
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:53
‪TYPO3\CMS\Core\Configuration\SiteConfiguration
Definition: SiteConfiguration.php:43
‪TYPO3\CMS\Install\ServiceProvider\getLoadTcaService
‪static getLoadTcaService(ContainerInterface $container)
Definition: ServiceProvider.php:162
‪TYPO3\CMS\Install\Controller\IconController
Definition: IconController.php:32
‪TYPO3\CMS\Install\ServiceProvider\getUpgradeWizardListCommand
‪static getUpgradeWizardListCommand(ContainerInterface $container)
Definition: ServiceProvider.php:297
‪TYPO3\CMS\Core\Console\CommandRegistry
Definition: CommandRegistry.php:31
‪TYPO3\CMS\Core\Console\CommandRegistry\addLazyCommand
‪addLazyCommand(string $commandName, string $serviceName, string $description=null, bool $hidden=false, bool $schedulable=false, string $aliasFor=null)
Definition: CommandRegistry.php:178
‪TYPO3\CMS\Core\Http\MiddlewareDispatcher
Definition: MiddlewareDispatcher.php:35
‪TYPO3\CMS\Install\ServiceProvider\getInstallerMiddleware
‪static getInstallerMiddleware(ContainerInterface $container)
Definition: ServiceProvider.php:193
‪TYPO3\CMS\Install\ServiceProvider\getApplication
‪static getApplication(ContainerInterface $container)
Definition: ServiceProvider.php:98
‪TYPO3\CMS\Core\Middleware\NormalizedParamsAttribute
Definition: NormalizedParamsAttribute.php:33
‪TYPO3\CMS\Install\ServiceProvider\getFactories
‪getFactories()
Definition: ServiceProvider.php:56
‪TYPO3\CMS\Install\ServiceProvider\getUpgradeController
‪static getUpgradeController(ContainerInterface $container)
Definition: ServiceProvider.php:271
‪TYPO3\CMS\Install\Service\WebServerConfigurationFileService
Definition: WebServerConfigurationFileService.php:28
‪TYPO3\CMS\Install\Middleware\Installer
Definition: Installer.php:38
‪TYPO3\CMS\Install\ServiceProvider\getMaintenanceMiddleware
‪static getMaintenanceMiddleware(ContainerInterface $container)
Definition: ServiceProvider.php:198
‪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:89
‪TYPO3\CMS\Install\ServiceProvider\getClearCacheService
‪static getClearCacheService(ContainerInterface $container)
Definition: ServiceProvider.php:117
‪TYPO3\CMS\Install
‪TYPO3\CMS\Install\ServiceProvider\configureCommands
‪static configureCommands(ContainerInterface $container, CommandRegistry $commandRegistry)
Definition: ServiceProvider.php:311
‪TYPO3\CMS\Core\Imaging\IconRegistry
Definition: IconRegistry.php:32
‪TYPO3\CMS\Install\ServiceProvider\getSilentConfigurationUpgradeService
‪static getSilentConfigurationUpgradeService(ContainerInterface $container)
Definition: ServiceProvider.php:169
‪TYPO3\CMS\Core\Http\RequestFactory
Definition: RequestFactory.php:31
‪TYPO3\CMS\Install\ServiceProvider\getNotFoundRequestHandler
‪static getNotFoundRequestHandler(ContainerInterface $container)
Definition: ServiceProvider.php:112
‪TYPO3\CMS\Install\Controller\LayoutController
Definition: LayoutController.php:42
‪TYPO3\CMS\Install\ServiceProvider
Definition: ServiceProvider.php:50
‪TYPO3\CMS\Install\ServiceProvider\getSilentTemplateFileUpgradeService
‪static getSilentTemplateFileUpgradeService(ContainerInterface $container)
Definition: ServiceProvider.php:176
‪TYPO3\CMS\Install\Controller\InstallerController
Definition: InstallerController.php:79
‪TYPO3\CMS\Install\ServiceProvider\getExtensionConfigurationService
‪static getExtensionConfigurationService(ContainerInterface $container)
Definition: ServiceProvider.php:137
‪TYPO3\CMS\Install\ServiceProvider\getLateBootService
‪static getLateBootService(ContainerInterface $container)
Definition: ServiceProvider.php:154
‪TYPO3\CMS\Install\Command\UpgradeWizardRunCommand
Definition: UpgradeWizardRunCommand.php:43
‪TYPO3\CMS\Install\ServiceProvider\getCoreVersionService
‪static getCoreVersionService(ContainerInterface $container)
Definition: ServiceProvider.php:132
‪TYPO3\CMS\Core\Log\LogManager
Definition: LogManager.php:33
‪TYPO3\CMS\Install\ServiceProvider\getUpgradeWizardsService
‪static getUpgradeWizardsService(ContainerInterface $container)
Definition: ServiceProvider.php:188
‪TYPO3\CMS\Install\ServiceProvider\getIconController
‪static getIconController(ContainerInterface $container)
Definition: ServiceProvider.php:215
‪TYPO3\CMS\Core\TypoScript\Parser\ConstantConfigurationParser
Definition: ConstantConfigurationParser.php:34
‪TYPO3\CMS\Install\Controller\MaintenanceController
Definition: MaintenanceController.php:50
‪TYPO3\CMS\Core\Middleware\VerifyHostHeader
Definition: VerifyHostHeader.php:31
‪TYPO3\CMS\Install\ServiceProvider\getLanguagePackService
‪static getLanguagePackService(ContainerInterface $container)
Definition: ServiceProvider.php:145
‪TYPO3\CMS\Install\Controller\SettingsController
Definition: SettingsController.php:48
‪TYPO3\CMS\Install\ServiceProvider\getLoginController
‪static getLoginController(ContainerInterface $container)
Definition: ServiceProvider.php:246
‪TYPO3\CMS\Install\ServiceProvider\getPermissionsCheck
‪static getPermissionsCheck(ContainerInterface $container)
Definition: ServiceProvider.php:306
‪TYPO3\CMS\Install\ServiceProvider\getWebServerConfigurationFileService
‪static getWebServerConfigurationFileService(ContainerInterface $container)
Definition: ServiceProvider.php:183
‪TYPO3\CMS\Install\Command\UpgradeWizardListCommand
Definition: UpgradeWizardListCommand.php:39
‪TYPO3\CMS\Install\ServiceProvider\getUpgradeWizardRunCommand
‪static getUpgradeWizardRunCommand(ContainerInterface $container)
Definition: ServiceProvider.php:288