diff --git a/modules/acquia_cms_common/src/EventSubscriber/KernelTerminate/AcquiaCmsTelemetry.php b/modules/acquia_cms_common/src/EventSubscriber/KernelTerminate/AcquiaCmsTelemetry.php index 2c47d1ff7..846e13192 100644 --- a/modules/acquia_cms_common/src/EventSubscriber/KernelTerminate/AcquiaCmsTelemetry.php +++ b/modules/acquia_cms_common/src/EventSubscriber/KernelTerminate/AcquiaCmsTelemetry.php @@ -138,7 +138,7 @@ public static function getSubscribedEvents(): array { * @throws \Exception */ public function onTerminateResponse(KernelEvent $event): void { - if ($this->shouldSendTelemetryData()) { + if ($this->shouldSendTelemetryData() && PHP_SAPI !== 'cli') { $this->sendTelemetry("ACMS Telemetry data", $this->getAcquiaCmsTelemetryData()); } } diff --git a/modules/acquia_cms_common/tests/src/Kernel/AcquiaCmsTelemetryTest.php b/modules/acquia_cms_common/tests/src/Kernel/AcquiaCmsTelemetryTest.php index 0beb49645..a8140d5a2 100644 --- a/modules/acquia_cms_common/tests/src/Kernel/AcquiaCmsTelemetryTest.php +++ b/modules/acquia_cms_common/tests/src/Kernel/AcquiaCmsTelemetryTest.php @@ -83,6 +83,7 @@ public function testIfTelemetryDataShouldSend(): void { $method = $this->getAcqauiaCmsTelemetryMethod("shouldSendTelemetryData"); $state_service = $this->container->get("state"); + $datetime_service = $this->container->get('datetime.time'); $shouldSendData = $method->invoke($this->acquiaCmsTelemetry); $this->assertFalse($shouldSendData, "Should not send telemetry data on Non Acquia environment."); @@ -95,16 +96,16 @@ public function testIfTelemetryDataShouldSend(): void { $shouldSendData = $method->invoke($this->acquiaCmsTelemetry); $this->assertTrue($shouldSendData, "Should send telemetry data on Acquia environment."); - $this->container->get("state")->set( + $state_service->set( "acquia_cms_common.telemetry.timestamp", - $this->container->get('datetime.time')->getCurrentTime() + $datetime_service->getCurrentTime() ); $shouldSendData = $method->invoke($this->acquiaCmsTelemetry); $this->assertFalse($shouldSendData, "Should not send telemetry data, if data send recently."); - $this->container->get("state")->set( + $state_service->set( "acquia_cms_common.telemetry.timestamp", - $this->container->get('datetime.time')->getCurrentTime() - 86401, + $datetime_service->getCurrentTime() - 86401, ); $shouldSendData = $method->invoke($this->acquiaCmsTelemetry); $this->assertTrue($shouldSendData, "Should send telemetry data, if data sent before a day."); diff --git a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsStarterKit/StarterKitConfigForm.php b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsStarterKit/StarterKitConfigForm.php index 61884dadd..e8b784098 100644 --- a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsStarterKit/StarterKitConfigForm.php +++ b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsStarterKit/StarterKitConfigForm.php @@ -32,6 +32,13 @@ class StarterKitConfigForm extends AcquiaCmsStarterKitBase { */ protected $starterKitService; + /** + * Starterkit service. + * + * @var \Drupal\Core\Config\ConfigFactoryInterface + */ + protected $configFactory; + /** * {@inheritdoc} */ @@ -39,7 +46,7 @@ public static function create(ContainerInterface $container) { /** @var static $instance */ $instance = parent::create($container); $instance->starterKitService = $container->get('acquia_cms_tour.starter_kit'); - + $instance->configFactory = $container->get('config.factory'); return $instance; } @@ -214,6 +221,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $missing_modules = $this->starterKitService->getMissingModules($starter_kit, $starter_kit_demo, $starter_kit_content_model); if (!$missing_modules) { $this->state->set('show_starter_kit_modal', FALSE); + $this->configFactory->getEditable('acquia_cms_common.settings')->set('starter_kit_name', $starter_kit)->save(); $this->state->set('starter_kit_wizard_completed', TRUE); $this->starterKitService->enableModules($starter_kit, $starter_kit_demo, $starter_kit_content_model); $this->messenger()->addStatus($this->t('The %starter_kit starter kit has been installed. Also, the related modules & themes have been enabled.', [