diff --git a/src/Controller/XHProfController.php b/src/Controller/XHProfController.php index fb0ab4a..f72252c 100644 --- a/src/Controller/XHProfController.php +++ b/src/Controller/XHProfController.php @@ -111,7 +111,7 @@ class XHProfController extends ControllerBase { ), 'path' => array( '#type' => 'inline_template', - '#template' => $this->t('Path: !path', array('!path' => $run->getPath())), + '#template' => $this->t('Path: :path', array(':path' => $run->getPath())), ), 'table' => array( '#theme' => 'table', diff --git a/src/XHProfLib/Run.php b/src/XHProfLib/Run.php index 85f42f3..684642a 100755 --- a/src/XHProfLib/Run.php +++ b/src/XHProfLib/Run.php @@ -18,8 +18,10 @@ class Run { * @var string */ private $namespace; - + /** + * URL path of the run. + * * @var string */ private $path; @@ -37,14 +39,14 @@ class Run { /** * @param string $run_id * @param string $namespace - * @param string $path * @param array $data + * @param string $path */ - public function __construct($run_id, $namespace, $path, $data) { + public function __construct($run_id, $namespace, $data, $path) { $this->run_id = $run_id; $this->namespace = $namespace; - $this->path = $path; $this->symbols = $this->parseSymbols($data); + $this->path = $path; } /** diff --git a/src/XHProfLib/Storage/FileStorage.php b/src/XHProfLib/Storage/FileStorage.php index 31e6264..0aa1779 100755 --- a/src/XHProfLib/Storage/FileStorage.php +++ b/src/XHProfLib/Storage/FileStorage.php @@ -2,7 +2,6 @@ namespace Drupal\xhprof\XHProfLib\Storage; -use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\xhprof\XHProfLib\Run; class FileStorage implements StorageInterface { @@ -61,7 +60,7 @@ class FileStorage implements StorageInterface { throw new \UnexpectedValueException("Unable to unserialize $file_name!"); } - $run = new Run($run_id, $namespace, $contents['path'], $contents['data']); + $run = new Run($run_id, $namespace, $contents['data'], $contents['path']); return $run; } @@ -70,7 +69,6 @@ class FileStorage implements StorageInterface { */ public function getRuns($namespace = NULL) { $files = $this->scanXHProfDir($this->dir, $namespace); - $files = array_map(function ($f) { $f['date'] = strtotime($f['date']); return $f; @@ -86,7 +84,7 @@ class FileStorage implements StorageInterface { // raw profiler data. $file_data = array( 'data' => $data, - 'path' => isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF'], + 'path' => \Drupal::requestStack()->getMasterRequest()->getRequestUri(), ); $file_data = serialize($file_data);