File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public static function instance()
19
19
20
20
public function environment ()
21
21
{
22
- return getenv ( ' WP_ENV ' ) ?: null ;
22
+ return \ Rollbar \ Wordpress \Plugin:: getEnvironment () ;
23
23
}
24
24
25
25
public function root ()
Original file line number Diff line number Diff line change @@ -52,6 +52,11 @@ public function configure(array $config) {
52
52
private function initSettings () {
53
53
Settings::init ();
54
54
}
55
+
56
+ public static function getEnvironment ()
57
+ {
58
+ return ( getenv ('WP_ENV ' ) ?: ( defined ( 'WP_ENV ' ) ? WP_ENV : null ) );
59
+ }
55
60
56
61
/**
57
62
* Fetch settings provided in Admin -> Tools -> Rollbar
@@ -68,7 +73,7 @@ private function fetchSettings() {
68
73
69
74
if (!isset ($ options ['environment ' ]) || empty ($ options ['environment ' ])) {
70
75
71
- if ($ wpEnv = getenv ( ' WP_ENV ' )) {
76
+ if ($ wpEnv = $ this -> getEnvironment ( )) {
72
77
$ options ['environment ' ] = $ wpEnv ;
73
78
}
74
79
Original file line number Diff line number Diff line change @@ -220,8 +220,10 @@ public static function status($settings)
220
220
221
221
public static function environmentSettingNote ()
222
222
{
223
+ $ env = \Rollbar \Wordpress \Plugin::getEnvironment ();
224
+
223
225
$ output =
224
- '<p><code>WP_ENV</code> environment variable: <code> ' . getenv ( ' WP_ENV ' ) . ' </code></p> ' .
226
+ '<p><code>WP_ENV</code> environment variable: <code> ' . $ env . '</code></p> ' .
225
227
'<p><small><strong>Rollbar for Wordpress honors the WP_ENV environment variable.</strong> ' .
226
228
'If the <code>environment</code> setting is not specified here, it will take ' .
227
229
'precendence over the default value.</strong></small></p> ' ;
You can’t perform that action at this time.
0 commit comments