function acquia_contenthub_post_update_update_config_entities in Acquia Content Hub 8.2
Migrate Content Hub configuration.
See also
acquia_contenthub_update_82001()
File
- ./
acquia_contenthub.post_update.php, line 18 - Post Update functions for Acquia Content Hub module.
Code
function acquia_contenthub_post_update_update_config_entities() {
// Exit early if we are not doing a migration.
$database = \Drupal::database();
if (!$database
->schema()
->tableExists('acquia_contenthub_entities_tracking')) {
return;
}
// Make sure existing webhook for the site in 1.x is unregistered.
$state = \Drupal::state();
$webhook_uuid = $state
->get('acquia_contenthub_update_82001_webhook_uuid', NULL);
if (!empty($webhook_uuid)) {
/** @var \Drupal\acquia_contenthub\Client\ClientFactory $client_factory */
$client_factory = \Drupal::service("acquia_contenthub.client.factory");
$settings = $client_factory
->getSettings();
$client = $client_factory
->getClient($settings);
// Unregister current webhook.
$client
->deleteWebhook($webhook_uuid);
}
// Deleting state variables if webhook is successfully registered.
$state
->delete('acquia_contenthub_update_82001_webhook_uuid');
}