You are here

function new_relic_rpm_drush_init in New Relic 7

Same name and namespace in other branches
  1. 8 new_relic_rpm.drush.inc \new_relic_rpm_drush_init()

Implements hook_drush_init().

File

./new_relic_rpm.drush.inc, line 11
New Relic Drush integration.

Code

function new_relic_rpm_drush_init() {
  if (function_exists('module_exists') && module_exists('new_relic_rpm')) {

    // Make sure we have access to the needed functions.
    require_once __DIR__ . '/new_relic_rpm.module';
    if (!new_relic_rpm_extension_installed()) {
      return;
    }

    // Add custom parameter, telling the drush command executed.
    $command = drush_get_command();
    $drush_command = array_merge(array(
      $command['command'],
    ), $command['arguments']);
    newrelic_add_custom_parameter('Drush command', implode(' ', $drush_command));

    // Set job state.
    new_relic_rpm_set_job_state(variable_get('new_relic_rpm_track_drush', 'norm'));
  }
}