You are here

function new_relic_rpm_module_deploy in New Relic 2.x

Same name and namespace in other branches
  1. 8 new_relic_rpm.module \new_relic_rpm_module_deploy()
  2. 7 new_relic_rpm.module \new_relic_rpm_module_deploy()
  3. 2.0.x new_relic_rpm.module \new_relic_rpm_module_deploy()

Log module install/uninstall actions as a deploy call to New Relic.

2 calls to new_relic_rpm_module_deploy()
new_relic_rpm_modules_installed in ./new_relic_rpm.module
Implements hook_modules_installed().
new_relic_rpm_modules_uninstalled in ./new_relic_rpm.module
Implements hook_modules_uninstalled().

File

./new_relic_rpm.module, line 39
Drupal module implementing New Relic.

Code

function new_relic_rpm_module_deploy($modules, $action) {
  if (!\Drupal::config('new_relic_rpm.settings')
    ->get('module_deployment')) {
    return;
  }
  $description = t(':action :modules', [
    ':action' => $action == 'install' ? t('Installed')
      ->render() : t('Uninstalled')
      ->render(),
    ':modules' => implode(', ', $modules),
  ]);

  /** @var \Drupal\new_relic_rpm\Client\NewRelicApiClient $client */
  $client = \Drupal::service('new_relic_rpm.client');
  $client
    ->createDeployment('module_change', $description
    ->render());
}