|
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; |
|
23
|
|
|
use TYPO3\CMS\Core\Configuration\SiteConfiguration; |
|
24
|
|
|
use TYPO3\CMS\Core\Console\CommandRegistry; |
|
25
|
|
|
use TYPO3\CMS\Core\Context\Context; |
|
26
|
|
|
use TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory; |
|
27
|
|
|
use TYPO3\CMS\Core\DependencyInjection\ContainerBuilder; |
|
28
|
|
|
use TYPO3\CMS\Core\Http\MiddlewareDispatcher; |
|
29
|
|
|
use TYPO3\CMS\Core\Http\RequestFactory; |
|
30
|
|
|
use TYPO3\CMS\Core\Imaging\IconFactory; |
|
31
|
|
|
use TYPO3\CMS\Core\Imaging\IconRegistry; |
|
32
|
|
|
use TYPO3\CMS\Core\Localization\LanguageServiceFactory; |
|
33
|
|
|
use TYPO3\CMS\Core\Localization\Locales; |
|
34
|
|
|
use TYPO3\CMS\Core\Middleware\NormalizedParamsAttribute as NormalizedParamsMiddleware; |
|
35
|
|
|
use TYPO3\CMS\Core\Package\AbstractServiceProvider; |
|
36
|
|
|
use TYPO3\CMS\Core\Package\FailsafePackageManager; |
|
37
|
|
|
use TYPO3\CMS\Core\Package\PackageManager; |
|
38
|
|
|
use TYPO3\CMS\Core\Registry; |
|
39
|
|
|
use TYPO3\CMS\Core\TypoScript\Parser\ConstantConfigurationParser; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @internal |
|
43
|
|
|
*/ |
|
44
|
|
|
class ServiceProvider extends AbstractServiceProvider |
|
45
|
|
|
{ |
|
46
|
|
|
protected static function getPackagePath(): string |
|
47
|
|
|
{ |
|
48
|
|
|
return __DIR__ . '/../'; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function getFactories(): array |
|
52
|
|
|
{ |
|
53
|
|
|
return [ |
|
54
|
|
|
Http\Application::class => [ static::class, 'getApplication' ], |
|
55
|
|
|
Http\NotFoundRequestHandler::class => [ static::class, 'getNotFoundRequestHandler' ], |
|
56
|
|
|
Service\ClearCacheService::class => [ static::class, 'getClearCacheService' ], |
|
57
|
|
|
Service\CoreUpdateService::class => [ static::class, 'getCoreUpdateService' ], |
|
58
|
|
|
Service\CoreVersionService::class => [ static::class, 'getCoreVersionService' ], |
|
59
|
|
|
Service\ExtensionConfigurationService::class => [ static::class, 'getExtensionConfigurationService' ], |
|
60
|
|
|
Service\LanguagePackService::class => [ static::class, 'getLanguagePackService' ], |
|
61
|
|
|
Service\LateBootService::class => [ static::class, 'getLateBootService' ], |
|
62
|
|
|
Service\LoadTcaService::class => [ static::class, 'getLoadTcaService' ], |
|
63
|
|
|
Service\SilentConfigurationUpgradeService::class => [ static::class, 'getSilentConfigurationUpgradeService' ], |
|
64
|
|
|
Service\Typo3tempFileService::class => [ static::class, 'getTypo3tempFileService' ], |
|
65
|
|
|
Service\UpgradeWizardsService::class => [ static::class, 'getUpgradeWizardsService' ], |
|
66
|
|
|
Middleware\Installer::class => [ static::class, 'getInstallerMiddleware' ], |
|
67
|
|
|
Middleware\Maintenance::class => [ static::class, 'getMaintenanceMiddleware' ], |
|
68
|
|
|
Controller\EnvironmentController::class => [ static::class, 'getEnvironmentController' ], |
|
69
|
|
|
Controller\IconController::class => [ static::class, 'getIconController' ], |
|
70
|
|
|
Controller\InstallerController::class => [ static::class, 'getInstallerController' ], |
|
71
|
|
|
Controller\LayoutController::class => [ static::class, 'getLayoutController' ], |
|
72
|
|
|
Controller\LoginController::class => [ static::class, 'getLoginController' ], |
|
73
|
|
|
Controller\MaintenanceController::class => [ static::class, 'getMaintenanceController' ], |
|
74
|
|
|
Controller\SettingsController::class => [ static::class, 'getSettingsController' ], |
|
75
|
|
|
Controller\UpgradeController::class => [ static::class, 'getUpgradeController' ], |
|
76
|
|
|
Command\LanguagePackCommand::class => [ static::class, 'getLanguagePackCommand' ], |
|
77
|
|
|
Command\UpgradeWizardRunCommand::class => [ static::class, 'getUpgradeWizardRunCommand' ], |
|
78
|
|
|
Command\UpgradeWizardListCommand::class => [ static::class, 'getUpgradeWizardListCommand' ], |
|
79
|
|
|
]; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
public function getExtensions(): array |
|
83
|
|
|
{ |
|
84
|
|
|
return [ |
|
85
|
|
|
CommandRegistry::class => [ static::class, 'configureCommands' ], |
|
86
|
|
|
]; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
public static function getApplication(ContainerInterface $container): Http\Application |
|
90
|
|
|
{ |
|
91
|
|
|
$requestHandler = $container->get(Http\NotFoundRequestHandler::class); |
|
92
|
|
|
$dispatcher = new MiddlewareDispatcher($requestHandler, [], $container); |
|
93
|
|
|
|
|
94
|
|
|
// Stack of middlewares, executed LIFO |
|
95
|
|
|
$dispatcher->lazy(Middleware\Installer::class); |
|
96
|
|
|
$dispatcher->add($container->get(Middleware\Maintenance::class)); |
|
97
|
|
|
$dispatcher->lazy(NormalizedParamsMiddleware::class); |
|
98
|
|
|
|
|
99
|
|
|
return new Http\Application($dispatcher, $container->get(Context::class)); |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
public static function getNotFoundRequestHandler(ContainerInterface $container): Http\NotFoundRequestHandler |
|
|
|
|
|
|
103
|
|
|
{ |
|
104
|
|
|
return new Http\NotFoundRequestHandler(); |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
public static function getClearCacheService(ContainerInterface $container): Service\ClearCacheService |
|
108
|
|
|
{ |
|
109
|
|
|
return new Service\ClearCacheService( |
|
110
|
|
|
$container->get(Service\LateBootService::class) |
|
111
|
|
|
); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
public static function getCoreUpdateService(ContainerInterface $container): Service\CoreUpdateService |
|
115
|
|
|
{ |
|
116
|
|
|
return new Service\CoreUpdateService( |
|
117
|
|
|
$container->get(Service\CoreVersionService::class) |
|
118
|
|
|
); |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
public static function getCoreVersionService(ContainerInterface $container): Service\CoreVersionService |
|
|
|
|
|
|
122
|
|
|
{ |
|
123
|
|
|
return new Service\CoreVersionService(); |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
public static function getExtensionConfigurationService(ContainerInterface $container): Service\ExtensionConfigurationService |
|
127
|
|
|
{ |
|
128
|
|
|
return new Service\ExtensionConfigurationService( |
|
129
|
|
|
$container->get(PackageManager::class), |
|
130
|
|
|
$container->get(ConstantConfigurationParser::class) |
|
131
|
|
|
); |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
public static function getLanguagePackService(ContainerInterface $container): Service\LanguagePackService |
|
135
|
|
|
{ |
|
136
|
|
|
return new Service\LanguagePackService( |
|
137
|
|
|
$container->get(EventDispatcherInterface::class), |
|
138
|
|
|
$container->get(RequestFactory::class) |
|
139
|
|
|
); |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
public static function getLateBootService(ContainerInterface $container): Service\LateBootService |
|
143
|
|
|
{ |
|
144
|
|
|
return new Service\LateBootService( |
|
145
|
|
|
$container->get(ContainerBuilder::class), |
|
146
|
|
|
$container |
|
147
|
|
|
); |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
public static function getLoadTcaService(ContainerInterface $container): Service\LoadTcaService |
|
151
|
|
|
{ |
|
152
|
|
|
return new Service\LoadTcaService( |
|
153
|
|
|
$container->get(Service\LateBootService::class) |
|
154
|
|
|
); |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
public static function getSilentConfigurationUpgradeService(ContainerInterface $container): Service\SilentConfigurationUpgradeService |
|
158
|
|
|
{ |
|
159
|
|
|
return new Service\SilentConfigurationUpgradeService( |
|
160
|
|
|
$container->get(ConfigurationManager::class) |
|
161
|
|
|
); |
|
162
|
|
|
} |
|
163
|
|
|
public static function getTypo3tempFileService(ContainerInterface $container): Service\Typo3tempFileService |
|
|
|
|
|
|
164
|
|
|
{ |
|
165
|
|
|
return new Service\Typo3tempFileService(); |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
public static function getUpgradeWizardsService(ContainerInterface $container): Service\UpgradeWizardsService |
|
|
|
|
|
|
169
|
|
|
{ |
|
170
|
|
|
return new Service\UpgradeWizardsService(); |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
public static function getInstallerMiddleware(ContainerInterface $container): Middleware\Installer |
|
174
|
|
|
{ |
|
175
|
|
|
return new Middleware\Installer($container); |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
public static function getMaintenanceMiddleware(ContainerInterface $container): Middleware\Maintenance |
|
179
|
|
|
{ |
|
180
|
|
|
return new Middleware\Maintenance( |
|
181
|
|
|
$container->get(FailsafePackageManager::class), |
|
182
|
|
|
$container->get(ConfigurationManager::class), |
|
183
|
|
|
$container->get(PasswordHashFactory::class), |
|
184
|
|
|
$container |
|
185
|
|
|
); |
|
186
|
|
|
} |
|
187
|
|
|
|
|
188
|
|
|
public static function getEnvironmentController(ContainerInterface $container): Controller\EnvironmentController |
|
189
|
|
|
{ |
|
190
|
|
|
return new Controller\EnvironmentController( |
|
191
|
|
|
$container->get(Service\LateBootService::class) |
|
192
|
|
|
); |
|
193
|
|
|
} |
|
194
|
|
|
|
|
195
|
|
|
public static function getIconController(ContainerInterface $container): Controller\IconController |
|
196
|
|
|
{ |
|
197
|
|
|
return new Controller\IconController( |
|
198
|
|
|
$container->get(IconRegistry::class), |
|
199
|
|
|
$container->get(IconFactory::class) |
|
200
|
|
|
); |
|
201
|
|
|
} |
|
202
|
|
|
|
|
203
|
|
|
public static function getInstallerController(ContainerInterface $container): Controller\InstallerController |
|
204
|
|
|
{ |
|
205
|
|
|
return new Controller\InstallerController( |
|
206
|
|
|
$container->get(Service\LateBootService::class), |
|
207
|
|
|
$container->get(Service\SilentConfigurationUpgradeService::class), |
|
208
|
|
|
$container->get(ConfigurationManager::class), |
|
209
|
|
|
$container->get(SiteConfiguration::class), |
|
210
|
|
|
$container->get(Registry::class), |
|
211
|
|
|
$container->get(FailsafePackageManager::class) |
|
212
|
|
|
); |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
|
public static function getLayoutController(ContainerInterface $container): Controller\LayoutController |
|
216
|
|
|
{ |
|
217
|
|
|
return new Controller\LayoutController( |
|
218
|
|
|
$container->get(Service\SilentConfigurationUpgradeService::class) |
|
219
|
|
|
); |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
public static function getLoginController(ContainerInterface $container): Controller\LoginController |
|
|
|
|
|
|
223
|
|
|
{ |
|
224
|
|
|
return new Controller\LoginController(); |
|
225
|
|
|
} |
|
226
|
|
|
|
|
227
|
|
|
public static function getMaintenanceController(ContainerInterface $container): Controller\MaintenanceController |
|
228
|
|
|
{ |
|
229
|
|
|
return new Controller\MaintenanceController( |
|
230
|
|
|
$container->get(Service\LateBootService::class), |
|
231
|
|
|
$container->get(Service\ClearCacheService::class), |
|
232
|
|
|
$container->get(Service\LanguagePackService::class), |
|
233
|
|
|
$container->get(Service\Typo3tempFileService::class), |
|
234
|
|
|
$container->get(ConfigurationManager::class), |
|
235
|
|
|
$container->get(PasswordHashFactory::class), |
|
236
|
|
|
$container->get(Locales::class) |
|
237
|
|
|
); |
|
238
|
|
|
} |
|
239
|
|
|
|
|
240
|
|
|
public static function getSettingsController(ContainerInterface $container): Controller\SettingsController |
|
241
|
|
|
{ |
|
242
|
|
|
return new Controller\SettingsController( |
|
243
|
|
|
$container->get(PackageManager::class), |
|
244
|
|
|
$container->get(Service\ExtensionConfigurationService::class), |
|
245
|
|
|
$container->get(LanguageServiceFactory::class) |
|
246
|
|
|
); |
|
247
|
|
|
} |
|
248
|
|
|
|
|
249
|
|
|
public static function getUpgradeController(ContainerInterface $container): Controller\UpgradeController |
|
250
|
|
|
{ |
|
251
|
|
|
return new Controller\UpgradeController( |
|
252
|
|
|
$container->get(PackageManager::class), |
|
253
|
|
|
$container->get(Service\LateBootService::class), |
|
254
|
|
|
$container->get(Service\UpgradeWizardsService::class) |
|
255
|
|
|
); |
|
256
|
|
|
} |
|
257
|
|
|
|
|
258
|
|
|
public static function getLanguagePackCommand(ContainerInterface $container): Command\LanguagePackCommand |
|
|
|
|
|
|
259
|
|
|
{ |
|
260
|
|
|
return new Command\LanguagePackCommand('language:update'); |
|
261
|
|
|
} |
|
262
|
|
|
|
|
263
|
|
|
public static function getUpgradeWizardRunCommand(ContainerInterface $container): Command\UpgradeWizardRunCommand |
|
264
|
|
|
{ |
|
265
|
|
|
return new Command\UpgradeWizardRunCommand( |
|
266
|
|
|
'upgrade:run', |
|
267
|
|
|
$container->get(Service\LateBootService::class), |
|
268
|
|
|
$container->get(Service\UpgradeWizardsService::class) |
|
269
|
|
|
); |
|
270
|
|
|
} |
|
271
|
|
|
|
|
272
|
|
|
public static function getUpgradeWizardListCommand(ContainerInterface $container): Command\UpgradeWizardListCommand |
|
273
|
|
|
{ |
|
274
|
|
|
return new Command\UpgradeWizardListCommand( |
|
275
|
|
|
'upgrade:list', |
|
276
|
|
|
$container->get(Service\LateBootService::class), |
|
277
|
|
|
$container->get(Service\UpgradeWizardsService::class) |
|
278
|
|
|
); |
|
279
|
|
|
} |
|
280
|
|
|
|
|
281
|
|
|
public static function configureCommands(ContainerInterface $container, CommandRegistry $commandRegistry): CommandRegistry |
|
282
|
|
|
{ |
|
283
|
|
|
$commandRegistry->addLazyCommand('language:update', Command\LanguagePackCommand::class); |
|
284
|
|
|
$commandRegistry->addLazyCommand('upgrade:run', Command\UpgradeWizardRunCommand::class); |
|
285
|
|
|
$commandRegistry->addLazyCommand('upgrade:list', Command\UpgradeWizardListCommand::class); |
|
286
|
|
|
return $commandRegistry; |
|
287
|
|
|
} |
|
288
|
|
|
} |
|
289
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.