From 1704b51d42946845d86da5d7988a3f0f3cc2614c Mon Sep 17 00:00:00 2001 From: Peter Dulacka Date: Thu, 10 Aug 2023 10:54:54 +0200 Subject: [PATCH] Fix commands not being available for synchronous web event handlers Beam currently emits synchronous events in some API handlers which effectively call Commands with a specific options and arguments. In order to run the command, it needs to be registered also for web requests, therefore we need to remove the CLI condition during the command registration process. remp/remp#1292 (cherry picked from commit 2a4c83a70d8cfb38c57411aff585d2abfd92066f) --- .../beam-module/src/BeamServiceProvider.php | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/Beam/extensions/beam-module/src/BeamServiceProvider.php b/Beam/extensions/beam-module/src/BeamServiceProvider.php index 3d8a568f2..a1b3ef5e7 100644 --- a/Beam/extensions/beam-module/src/BeamServiceProvider.php +++ b/Beam/extensions/beam-module/src/BeamServiceProvider.php @@ -209,28 +209,26 @@ public function register() protected function registerCommands(): void { - if ($this->app->runningInConsole()) { - $this->commands([ - Console\Commands\AggregateArticlesViews::class, - Console\Commands\AggregateConversionEvents::class, - Console\Commands\AggregatePageviewLoadJob::class, - Console\Commands\AggregatePageviews::class, - Console\Commands\AggregatePageviewTimespentJob::class, - Console\Commands\CompressAggregations::class, - Console\Commands\CompressSnapshots::class, - Console\Commands\ComputeAuthorsSegments::class, - Console\Commands\ComputeSectionSegments::class, - Console\Commands\DashboardRefresh::class, - Console\Commands\DeleteDuplicatePageviews::class, - Console\Commands\DeleteOldAggregations::class, - Console\Commands\ElasticDataRetention::class, - Console\Commands\ElasticWriteAliasRollover::class, - Console\Commands\ProcessConversionSources::class, - Console\Commands\ProcessPageviewLoyalVisitors::class, - Console\Commands\ProcessPageviewSessions::class, - Console\Commands\SendNewslettersCommand::class, - Console\Commands\SnapshotArticlesViews::class, - ]); - } + $this->commands([ + Console\Commands\AggregateArticlesViews::class, + Console\Commands\AggregateConversionEvents::class, + Console\Commands\AggregatePageviewLoadJob::class, + Console\Commands\AggregatePageviews::class, + Console\Commands\AggregatePageviewTimespentJob::class, + Console\Commands\CompressAggregations::class, + Console\Commands\CompressSnapshots::class, + Console\Commands\ComputeAuthorsSegments::class, + Console\Commands\ComputeSectionSegments::class, + Console\Commands\DashboardRefresh::class, + Console\Commands\DeleteDuplicatePageviews::class, + Console\Commands\DeleteOldAggregations::class, + Console\Commands\ElasticDataRetention::class, + Console\Commands\ElasticWriteAliasRollover::class, + Console\Commands\ProcessConversionSources::class, + Console\Commands\ProcessPageviewLoyalVisitors::class, + Console\Commands\ProcessPageviewSessions::class, + Console\Commands\SendNewslettersCommand::class, + Console\Commands\SnapshotArticlesViews::class, + ]); } }