Skip to content

Commit

Permalink
LCH-6836: Removed amplitude from common-console. (#47)
Browse files Browse the repository at this point in the history
* LCH-6836: Removed amplitude from common-console.

* Fixing tests.

* Passing default command name.

* LCH-6836: Removing config key.
  • Loading branch information
narendradesai authored Mar 20, 2024
1 parent 9c1b152 commit 075e820
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 256 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
"acquia/acsf-contenthub-console": "dev-main",
"ext-json": "*",
"ext-simplexml": "*",
"spatie/ssl-certificate": "1.21|1.22.1|^2",
"zumba/amplitude-php": "^1"
"spatie/ssl-certificate": "1.21|1.22.1|^2"
},
"autoload": {
"psr-4": {
Expand Down
85 changes: 0 additions & 85 deletions src/Client/AmplitudeClient.php

This file was deleted.

2 changes: 0 additions & 2 deletions src/Client/config/amplitude_api_key.yml

This file was deleted.

30 changes: 1 addition & 29 deletions src/Command/ContentHubUpgradeStart.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
use Acquia\Console\ContentHub\Command\Cron\AcquiaCloudCronCreateMultiSite;
use Acquia\Console\Cloud\Platform\AcquiaCloudMultiSitePlatform;
use Acquia\Console\Cloud\Platform\AcquiaCloudPlatform;
use Acquia\Console\ContentHub\Command\Helpers\AmplitudeClientInterface;
use Acquia\Console\ContentHub\Command\Helpers\AmplitudeClientTrait;
use Acquia\Console\Helpers\Command\PlatformGroupTrait;
use Acquia\Console\Helpers\PlatformCommandExecutioner;
use Acquia\Console\Helpers\Command\PlatformCmdOutputFormatterTrait;
Expand Down Expand Up @@ -38,11 +36,10 @@
*
* @package Acquia\Console\ContentHub\Command
*/
class ContentHubUpgradeStart extends Command implements PlatformCommandInterface, AmplitudeClientInterface {
class ContentHubUpgradeStart extends Command implements PlatformCommandInterface {

use PlatformCommandTrait;
use PlatformCmdOutputFormatterTrait;
use AmplitudeClientTrait;
use PlatformGroupTrait;

/**
Expand Down Expand Up @@ -100,19 +97,10 @@ public function __construct(EventDispatcherInterface $dispatcher, PlatformComman
$this->platformCommandExecutioner = $platform_command_executioner;
}

/**
* {@inheritDoc}
*/
public function initialize(InputInterface $input, OutputInterface $output) {
// Initialize the Amplitude Client.
$this->initializeAmplitudeClient($input, $output);
}

/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->sendLogsToAmplitude('CHUC Upgrade process', 0, 'Upgrade process started.');
$output->writeln('Welcome to the Acquia Content Hub Upgrade!');
$output->writeln('This command line utility is designed to help you upgrade from Content Hub 1.x to 2.x.');
$output->writeln('If you encounter any issues, please file a ticket with Acquia Support.');
Expand All @@ -125,7 +113,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
// Reset stage tracking if restart option is used.
if ($input->getOption('restart')) {
$platform->set('acquia.content_hub.upgrade.stage', 0)->save();
$this->sendLogsToAmplitude('CHUC Upgrade process', 0, 'Upgrade process restarted.');
}

// Set Content Hub Credentials for Upgrade.
Expand All @@ -136,22 +123,18 @@ protected function execute(InputInterface $input, OutputInterface $output): int
// Running Content Hub Audit in the current platform.
$pass = $this->executeStage($stage, 0);
$this->executeContentHubAuditCommand($platform, $input, $output, $helper, $pass);
$this->sendLogsToAmplitude('CHUC Upgrade process', 1, 'Content Hub Audit completed.');

// Generate Database Backups and service snapshot.
$pass = $this->executeStage($stage, 1);
$this->executeDatabaseBackups($application, $platform, $input, $output, $helper, $pass);
$this->sendLogsToAmplitude('CHUC Upgrade process', 2, 'Database and Service Snapshot completed.');

// Purge Subscription and delete Webhooks.
$pass = $this->executeStage($stage, 2);
$this->purgeSubscriptionDeleteWebhooks($platform, $input, $output, $helper, $pass);
$this->sendLogsToAmplitude('CHUC Upgrade process', 3, 'Subscription purged and Webhooks deleted');

// Prepare Upgrade Command.
$pass = $this->executeStage($stage, 3);
$this->executePrepareUpgradeCommand($platform, $input, $output, $helper, $pass);
$this->sendLogsToAmplitude('CHUC Upgrade process', 4, 'Upgrade preparation completed.');

// Make sure Content Hub version 2 is deployed in all sites.
$is_lift_customer = $platform->get(ContentHubLiftVersion::ACQUIA_LIFT_USAGE);
Expand All @@ -161,57 +144,46 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
$helper->ask($input, $output, $quest);
$this->executeContentHubVersionCheck($application, $platform, $input, $output);
$this->sendLogsToAmplitude('CHUC Upgrade process', 4.1, 'Content Hub Version checked. Found version 2');

// Run Publisher Upgrade Command.
$pass = $this->executeStage($stage, 4);
$this->executePublisherUpgradeCommand($platform, $input, $output, $helper, $pass);
$this->sendLogsToAmplitude('CHUC Upgrade process', 5, 'Publisher Upgrade completed');

// Creates Scheduled Jobs for Publisher/Subscriber Queues.
$pass = $this->executeStage($stage, 5);
$this->createContentHubScheduledJobs($application, $platform, $input, $output, $helper, $pass);
$this->sendLogsToAmplitude('CHUC Upgrade process', 6, 'Scheduled jobs created');

$quest = new ConfirmationQuestion('Please wait until ALL publisher queues have finished exporting data. Press a key when ready.');
$helper->ask($input, $output, $quest);

// Run validations on the publisher queues.
$pass = $this->executeStage($stage, 6);
$this->executeValidatePublisherQueues($platform, $input, $output, $helper, $pass);
$this->sendLogsToAmplitude('CHUC Upgrade process', 7, 'Publisher queues validated.');

// Run Subscriber Upgrade Command.
$pass = $this->executeStage($stage, 7);
$this->executeSubscriberUpgradeCommand($platform, $input, $output, $helper, $pass);
$this->sendLogsToAmplitude('CHUC Upgrade process', 8, 'Subscriber upgrade completed.');

// Enable Unsubscribe module if there are imported entities with local changes / auto-update disabled.
$pass = $this->executeStage($stage, 8);
$this->executeEnableUnsubscribeCommand($platform, $input, $output, $helper, $pass);
$this->sendLogsToAmplitude('CHUC Upgrade process', 9, 'Unsubscribe module check finished.');

// Run Validations on the upgraded subscription.
$pass = $this->executeStage($stage, 9);
$this->executeValidateSiteWebhooksCommand($platform, $input, $output, $helper, $pass);
$this->sendLogsToAmplitude('CHUC Upgrade process', 10, 'Site webhooks validated.');

// Validate that default filters are attached to webhooks and all filters have been upgraded.
$pass = $this->executeStage($stage, 10);
$this->executeValidateDefaultFiltersCommand($platform, $input, $output, $helper, $pass);
$this->sendLogsToAmplitude('CHUC Upgrade process', 11, 'Default filter validation completed.');

// Run validations on the interest list diff.
$pass = $this->executeStage($stage, 11);
$this->executeValidateInterestListDiff($platform, $input, $output, $helper, $pass);
$this->sendLogsToAmplitude('CHUC Upgrade process', 12, 'Validations for interest list differences completed.');

// Finalize process.
$output->writeln('<warning>The Curation module has been enabled on publisher sites. You can manually enable it on subscriber sites if desired.</warning>');
$output->writeln('<info>Content Hub Upgrade process has been completed successfully. Please check your sites.</info>');
$output->writeln('<warning>The Diff module is no longer required by Content Hub and may not be required by your application. Please check and remove if applicable.</warning>');
$this->sendLogsToAmplitude('CHUC Upgrade process', 13, 'Upgrade process completed.');
$this->amplitudeClient->logEvent('CHUC Upgrade process completed', $this->userDetails);
return 0;
}

Expand Down
46 changes: 0 additions & 46 deletions src/Command/Helpers/AmplitudeClientInterface.php

This file was deleted.

92 changes: 0 additions & 92 deletions src/Command/Helpers/AmplitudeClientTrait.php

This file was deleted.

0 comments on commit 075e820

Please sign in to comment.