You are here

public function AcquiaContenthubCommands::contenthubDisconnectSite in Acquia Content Hub 8

Disconnects a site with contenthub.

@command acquia:contenthub-disconnect-site @aliases ach-disconnect,acquia-contenthub-disconnect-site

File

src/Commands/AcquiaContenthubCommands.php, line 597

Class

AcquiaContenthubCommands
A Drush commandfile.

Namespace

Drupal\acquia_contenthub\Commands

Code

public function contenthubDisconnectSite() {

  /** @var \Drupal\acquia_contenthub\ContentHubSubscription $subscription */
  $subscription = \Drupal::service('acquia_contenthub.acquia_contenthub_subscription');
  $subscription
    ->disconnectClient();

  // disconnectClient always returns false. Check config to be sure of success.
  $config_factory = \Drupal::configFactory();
  $config = $config_factory
    ->getEditable('acquia_contenthub.admin_settings');
  $webhook_uuid = $config
    ->get('webhook_uuid');
  if (!$webhook_uuid) {
    $this
      ->logger()
      ->log(LogLevel::SUCCESS, dt('Site has been disconnected from Content Hub.'));
  }
}