File tree 2 files changed +11
-1
lines changed
src/Symfony/Bundle/FrameworkBundle 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ public function __construct(
42
42
private readonly Profiler $ profiler ,
43
43
private readonly RequestStack $ requestStack ,
44
44
private readonly Stopwatch $ stopwatch ,
45
+ private readonly bool $ cliMode ,
45
46
private readonly UrlGeneratorInterface $ urlGenerator ,
46
47
) {
47
48
$ this ->profiles = new \SplObjectStorage ();
@@ -59,6 +60,10 @@ public static function getSubscribedEvents(): array
59
60
60
61
public function initialize (ConsoleCommandEvent $ event ): void
61
62
{
63
+ if (!$ this ->cliMode ) {
64
+ return ;
65
+ }
66
+
62
67
$ input = $ event ->getInput ();
63
68
if (!$ input ->hasOption ('profile ' ) || !$ input ->getOption ('profile ' )) {
64
69
$ this ->profiler ->disable ();
@@ -78,12 +83,16 @@ public function initialize(ConsoleCommandEvent $event): void
78
83
79
84
public function catch (ConsoleErrorEvent $ event ): void
80
85
{
86
+ if (!$ this ->cliMode ) {
87
+ return ;
88
+ }
89
+
81
90
$ this ->error = $ event ->getError ();
82
91
}
83
92
84
93
public function profile (ConsoleTerminateEvent $ event ): void
85
94
{
86
- if (!$ this ->profiler ->isEnabled ()) {
95
+ if (!$ this ->cliMode || ! $ this -> profiler ->isEnabled ()) {
87
96
return ;
88
97
}
89
98
Original file line number Diff line number Diff line change 43
43
service ('profiler ' ),
44
44
service ('.virtual_request_stack ' ),
45
45
service ('debug.stopwatch ' ),
46
+ param ('kernel.runtime_mode.cli ' ),
46
47
service ('router ' ),
47
48
])
48
49
->tag ('kernel.event_subscriber ' )
You can’t perform that action at this time.
0 commit comments