function drush_acquia_contenthub_regenerate_secret in Acquia Content Hub 8
Regenerates a Shared Secret from the Content Hub.
File
- ./
acquia_contenthub.drush.inc, line 693 - ContentHub Drush Commands.
Code
function drush_acquia_contenthub_regenerate_secret() {
/** @var \Drupal\acquia_contenthub\Client\ClientManager $client_manager */
$client_manager = \Drupal::service('acquia_contenthub.client_manager');
$warning_message = "Are you sure you want to REGENERATE your shared-secret in the Content Hub?\n" . "*************************************************************************************\n" . "PROCEED WITH CAUTION. THIS COULD POTENTIALLY LEAD TO HAVING SOME SITES OUT OF SYNC.\n" . "Make sure you have ALL your sites correctly configured to receive webhooks before attempting to do this.\n" . "For more information, check https://docs.acquia.com/content-hub/known-issues.\n" . "*************************************************************************************\n";
if (drush_confirm($warning_message)) {
if ($client_manager
->isConnected()) {
$output = $client_manager
->createRequest('regenerateSharedSecret');
}
else {
return drush_set_error(dt('Error trying to connect to the Content Hub. Make sure this site is registered to Content hub.'));
}
if ($output) {
drush_print("Your Shared Secret has been regenerated. All clients who have registered to received webhooks are being notified of this change.\n");
}
else {
return drush_set_error(dt("Error trying to regenerate the shared-secret in your subscription. Try again later."));
}
}
else {
return drush_user_abort();
}
}