Skip to content
Snippets Groups Projects
Commit 73a7e327 authored by Ere Maijala's avatar Ere Maijala Committed by Demian Katz
Browse files

Removed xhprof_lib dependency when writing profiler data. (#967)

- Maintains functionality while eliminating the need to add xhprof_lib to the PHP include path.
parent 2f6ea00f
No related merge requests found
...@@ -61,8 +61,7 @@ Alias /vufind /usr/local/vufind/public ...@@ -61,8 +61,7 @@ Alias /vufind /usr/local/vufind/public
#SetEnv VUFIND_ENV development #SetEnv VUFIND_ENV development
# Uncomment this line if you want to use the XHProf or Tideways profiler; this is a # Uncomment this line if you want to use the XHProf or Tideways profiler; this is a
# developer-oriented option that most users will not need. Make sure the XHProf PHP # developer-oriented option that most users will not need.
# libraries are available on your include path.
# See https://vufind.org/wiki/development:profiling for more details. # See https://vufind.org/wiki/development:profiling for more details.
#SetEnv VUFIND_PROFILER_XHPROF http://url/to/your/xhprof/web/interface #SetEnv VUFIND_PROFILER_XHPROF http://url/to/your/xhprof/web/interface
......
...@@ -85,11 +85,13 @@ Zend\Mvc\Application::init(require 'config/application.config.php')->run(); ...@@ -85,11 +85,13 @@ Zend\Mvc\Application::init(require 'config/application.config.php')->run();
// Handle final profiling details, if necessary: // Handle final profiling details, if necessary:
if ($xhprof) { if ($xhprof) {
$xhprofData = extension_loaded('xhprof') ? xhprof_disable() : tideways_disable(); $xhprofData = extension_loaded('xhprof') ? xhprof_disable() : tideways_disable();
require_once "xhprof_lib/utils/xhprof_lib.php"; $xhprofRunId = uniqid();
require_once "xhprof_lib/utils/xhprof_runs.php";
$xhprofRuns = new XHProfRuns_Default();
$suffix = 'vufind'; $suffix = 'vufind';
$xhprofRunId = $xhprofRuns->save_run($xhprofData, $suffix); $dir = ini_get('xhprof.output_dir');
if (empty($dir)) {
$dir = sys_get_temp_dir();
}
file_put_contents("$dir/$xhprofRunId.$suffix.xhprof", serialize($xhprofData));
$url = "$xhprof?run=$xhprofRunId&source=$suffix"; $url = "$xhprof?run=$xhprofRunId&source=$suffix";
echo "<a href='$url'>Profiler output</a>"; echo "<a href='$url'>Profiler output</a>";
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment