Internal: Fix xhprof loading for new Tideways library version

pull/4448/head
Yannick Warnier 3 years ago
parent 4b6f03fe34
commit c69c790263
  1. 3
      tests/xhprof/README.md
  2. 5
      tests/xhprof/footer.php
  3. 5
      tests/xhprof/header.php

@ -7,7 +7,7 @@ forked it, between other reasons to provide support for PHP 7.
## Install procedure
To enable the profiler into Chamilo, you will need to do the following:
- install the tideways-php library from https://tideways.io/profiler/downloads
- install the php[version]-tideways library from https://tideways.io/profiler/downloads or your package manager
- add the following two lines to your Apache VirtualHost or (in a slightly different form) to your php.ini config
(don't forget to update the path to your Chamilo root directory):
```
@ -19,6 +19,7 @@ To enable the profiler into Chamilo, you will need to do the following:
```
# Deny access
#RewriteRule ^(tests|.git) - [F,L,NC]
RewriteRule ^.git - [F,L,NC]
```
## Using XHProf

@ -5,12 +5,13 @@
/**
* Init
*/
use Tideways\Profiler;
$isAjaxRequest = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest';
if (extension_loaded('tideways') && !$isAjaxRequest) {
if (extension_loaded('tideways_xhprof') && !$isAjaxRequest) {
$profiler_namespace = 'chamilolms'; // namespace for your application
$xhprof_data = tideways_disable();
$xhprof_data = tideways_xhprof_disable();
//$xhprof_runs = new XHProfRuns_Default();
//$run_id = $xhprof_runs->save_run($xhprof_data, $profiler_namespace);
$run_id = uniqid();

@ -11,11 +11,12 @@
* in your php config also disable the .htaccess line about the tests/
* directory.
*/
use Tideways\Profiler;
$isAjaxRequest = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest';
if (extension_loaded('tideways') && !$isAjaxRequest) {
if (extension_loaded('tideways_xhprof') && !$isAjaxRequest) {
//include_once __DIR__.'/xhprof_lib/utils/xhprof_lib.php';
//include_once __DIR__.'/xhprof_lib/utils/xhprof_runs.php';
tideways_enable(TIDEWAYS_FLAGS_NO_SPANS);
tideways_xhprof_enable();
}

Loading…
Cancel
Save