-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew_relic_rpm.drush.inc
50 lines (41 loc) · 1.37 KB
/
new_relic_rpm.drush.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* @file
* New Relic RPM Drush integration.
*/
/**
* Implements hook_drush_init().
*/
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 dirname(__FILE__) . '/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'));
}
}
/**
* Implements hook_drush_command().
*/
function new_relic_rpm_drush_command() {
$items = array();
$items['newrelic-deploy'] = array(
'callback' => '_new_relic_rpm_deploy',
'description' => dt('Notify New Relic of a deployment.'),
'arguments' => array(
'user' => dt('Optional. User doing the deploy.'),
'description' => dt('Optional. A brief describing of the deployment.'),
'changelog' => dt('Optional. A list of changes for this deployment.'),
'revision' => dt('Optional. Revision id of the deployment.'),
),
'aliases' => array('nrd'),
);
return $items;
}