16
16
use Shopware \Core \Framework \Log \Package ;
17
17
use Shopware \Core \Framework \Plugin ;
18
18
use Shopware \Core \Kernel ;
19
+ use Shopware \Core \Maintenance \Staging \Event \SetupStagingEvent ;
19
20
use Shopware \Core \Maintenance \System \Service \AppUrlVerifier ;
20
21
use Shopware \Core \PlatformRequest ;
22
+ use Shopware \Core \System \SystemConfig \SystemConfigService ;
21
23
use Symfony \Bundle \FrameworkBundle \Controller \AbstractController ;
22
24
use Symfony \Component \Asset \PackageInterface ;
23
25
use Symfony \Component \Asset \Packages ;
26
28
use Symfony \Component \HttpFoundation \Request ;
27
29
use Symfony \Component \HttpFoundation \Response ;
28
30
use Symfony \Component \Routing \Attribute \Route ;
31
+ use Symfony \Component \Routing \Generator \UrlGeneratorInterface ;
29
32
use Symfony \Component \Routing \RouterInterface ;
30
33
31
34
#[Route(defaults: ['_routeScope ' => ['api ' ]])]
32
35
#[Package('core ' )]
33
36
class InfoController extends AbstractController
34
37
{
35
38
/**
36
- * @param array{administration?: string} $cspTemplates
37
- *
38
39
* @internal
39
40
*/
40
41
public function __construct (
@@ -47,9 +48,8 @@ public function __construct(
47
48
private readonly Connection $ connection ,
48
49
private readonly AppUrlVerifier $ appUrlVerifier ,
49
50
private readonly RouterInterface $ router ,
50
- private readonly ?FlowActionCollector $ flowActionCollector = null ,
51
- private readonly bool $ enableUrlFeature = true ,
52
- private readonly array $ cspTemplates = [],
51
+ private readonly FlowActionCollector $ flowActionCollector ,
52
+ private readonly SystemConfigService $ systemConfigService
53
53
) {
54
54
}
55
55
@@ -128,7 +128,7 @@ public function infoHtml(Request $request): Response
128
128
]
129
129
);
130
130
131
- $ cspTemplate = $ this ->cspTemplates ['administration ' ] ?? '' ;
131
+ $ cspTemplate = $ this ->params -> get ( ' shopware.security.csp_templates ' ) ['administration ' ] ?? '' ;
132
132
$ cspTemplate = trim ($ cspTemplate );
133
133
if ($ cspTemplate !== '' ) {
134
134
$ csp = str_replace ('%nonce% ' , $ nonce , $ cspTemplate );
@@ -153,7 +153,7 @@ public function stoplightIoInfoHtml(Request $request): Response
153
153
]
154
154
);
155
155
156
- $ cspTemplate = $ this ->cspTemplates ['administration ' ] ?? '' ;
156
+ $ cspTemplate = $ this ->params -> get ( ' shopware.security.csp_templates ' ) ['administration ' ] ?? '' ;
157
157
$ cspTemplate = trim ($ cspTemplate );
158
158
if ($ cspTemplate !== '' ) {
159
159
$ csp = str_replace ('%nonce% ' , $ nonce , $ cspTemplate );
@@ -178,11 +178,12 @@ public function config(Context $context, Request $request): JsonResponse
178
178
],
179
179
'bundles ' => $ this ->getBundles (),
180
180
'settings ' => [
181
- 'enableUrlFeature ' => $ this ->enableUrlFeature ,
181
+ 'enableUrlFeature ' => $ this ->params -> get ( ' shopware.media.enable_url_upload_feature ' ) ,
182
182
'appUrlReachable ' => $ this ->appUrlVerifier ->isAppUrlReachable ($ request ),
183
183
'appsRequireAppUrl ' => $ this ->appUrlVerifier ->hasAppsThatNeedAppUrl (),
184
184
'private_allowed_extensions ' => $ this ->params ->get ('shopware.filesystem.private_allowed_extensions ' ),
185
185
'enableHtmlSanitizer ' => $ this ->params ->get ('shopware.html_sanitizer.enabled ' ),
186
+ 'enableStagingMode ' => $ this ->params ->get ('shopware.staging.administration.show_banner ' ) && $ this ->systemConfigService ->getBool (SetupStagingEvent::CONFIG_FLAG ),
186
187
],
187
188
]);
188
189
}
@@ -199,13 +200,7 @@ public function infoShopwareVersion(): JsonResponse
199
200
#[Route(path: '/api/_info/flow-actions.json ' , name: 'api.info.actions ' , methods: ['GET ' ])]
200
201
public function flowActions (Context $ context ): JsonResponse
201
202
{
202
- if (!$ this ->flowActionCollector ) {
203
- return $ this ->json ([]);
204
- }
205
-
206
- $ events = $ this ->flowActionCollector ->collect ($ context );
207
-
208
- return new JsonResponse ($ events );
203
+ return new JsonResponse ($ this ->flowActionCollector ->collect ($ context ));
209
204
}
210
205
211
206
/**
@@ -323,7 +318,7 @@ private function getBaseUrl(Bundle $bundle, PackageInterface $package, string $b
323
318
[
324
319
'pluginName ' => \mb_strtolower ($ bundle ->getName ()),
325
320
],
326
- RouterInterface ::ABSOLUTE_URL
321
+ UrlGeneratorInterface ::ABSOLUTE_URL
327
322
);
328
323
} catch (\Exception $ e ) {
329
324
return null ;
0 commit comments