Skip to content

Instantly share code, notes, and snippets.

@msonnabaum
Created June 19, 2014 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msonnabaum/fcffe595f29fa54f8c8c to your computer and use it in GitHub Desktop.
Save msonnabaum/fcffe595f29fa54f8c8c to your computer and use it in GitHub Desktop.
diff --git a/puppet/versions/devel/modules/xhprof/files/acquia_xhprof/acquia_xhprof.php b/puppet/versions/devel/modules/xhprof/files/acquia_xhprof/acquia_xhprof.php
index 5cfa756..1bcf4e3 100644
--- a/puppet/versions/devel/modules/xhprof/files/acquia_xhprof/acquia_xhprof.php
+++ b/puppet/versions/devel/modules/xhprof/files/acquia_xhprof/acquia_xhprof.php
@@ -38,8 +38,11 @@ function acquia_hosting_xhprof_enabled() {
// Can't use ini_get here since it's a custom variable.
$xhprof_enabled = get_cfg_var('acquia.xhprof_enabled');
- $ret = FALSE;
if ($xhprof_enabled) {
+ // Regardless of sampling interval, enable for this request if explicitly
+ // requested via a query string.
+ if (array_key_exists('AH_XHPROF', $_GET)) return TRUE;
+
$sampling_interval = acquia_hosting_xhprof_sampling_interval();
// Return early in the case of 0, since it would throw an error if passed as
@@ -48,6 +51,7 @@ function acquia_hosting_xhprof_enabled() {
return FALSE;
}
+ $ret = FALSE;
if (mt_rand(1, $sampling_interval) == 1) {
$ret = TRUE;
}
@@ -55,11 +59,6 @@ function acquia_hosting_xhprof_enabled() {
$ret = FALSE;
}
- // Regardless of sampling interval, enable for this request if explicitly
- // requested via a query string.
- if (array_key_exists('AH_XHPROF', $_GET)) {
- $ret = TRUE;
- }
}
return $ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment