Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LCH-6902: Remove Amplitude from CHUC #46

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
55 changes: 23 additions & 32 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,34 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
defaultTestSuite="ContentHub Console Library"
processIsolation="false"
stopOnFailure="false"
colors="true">

<testsuites>
<testsuite name="ContentHub Console Library">
<directory suffix="Test.php">tests/Command</directory>
<directory suffix="Test.php">tests/EventSubscriber</directory>
</testsuite>
<testsuite name="ContentHub Console - Drupal">
<directory suffix="Test.php">tests/Drupal</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
<exclude>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="build/coverage" />
<log type="coverage-clover" target="build/logs/clover.xml" />
</logging>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" defaultTestSuite="ContentHub Console Library" processIsolation="false" stopOnFailure="false" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
<exclude>
<directory>./vendor</directory>
</exclude>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage"/>
</report>
</coverage>
<testsuites>
<testsuite name="ContentHub Console Library">
<directory suffix="Test.php">tests/Command</directory>
<directory suffix="Test.php">tests/EventSubscriber</directory>
</testsuite>
<testsuite name="ContentHub Console - Drupal">
<directory suffix="Test.php">tests/Drupal</directory>
</testsuite>
</testsuites>
<logging/>
</phpunit>
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.

Loading
Loading