diff options
author | Alpha <ngcoder@live.com> | 2015-11-19 14:16:11 -0500 |
---|---|---|
committer | Alpha <ngcoder@live.com> | 2015-11-19 14:17:14 -0500 |
commit | a74facec06094cdfb7c4c81a0f0daea00bc94b84 (patch) | |
tree | 817ceab8462a28959dbf117d2a4c238c8cf65398 | |
parent | 699f55e207e3c7c12f2ee838a22002c430013796 (diff) | |
download | webgrind-a74facec06094cdfb7c4c81a0f0daea00bc94b84.zip webgrind-a74facec06094cdfb7c4c81a0f0daea00bc94b84.tar.gz webgrind-a74facec06094cdfb7c4c81a0f0daea00bc94b84.tar.bz2 |
Add warning message if call graph fails due to missing executables
Modify default `dot` path to match `python`
-rw-r--r-- | config.php | 2 | ||||
-rw-r--r-- | index.php | 25 |
2 files changed, 18 insertions, 9 deletions
@@ -44,7 +44,7 @@ class Webgrind_Config extends Webgrind_MasterConfig { /** * Path to graphviz dot executable */ - static $dotExecutable = '/usr/local/bin/dot'; + static $dotExecutable = '/usr/bin/dot'; /** * sprintf compatible format for generating links to source files. @@ -123,7 +123,6 @@ try { case 'fileviewer': $file = get('file'); - $line = get('line'); if ($file && $file!='') { $message = ''; @@ -148,12 +147,6 @@ try { $dataFile = $files[0]['filename']; } - if (Webgrind_Config::$graphImageType == 'svg') { - header('Content-Type: image/svg+xml'); - } else { - header('Content-Type: image/'.Webgrind_Config::$graphImageType); - } - $filename = Webgrind_Config::storageDir().$dataFile.'-'.$showFraction.Webgrind_Config::$preprocessedSuffix.'.'.Webgrind_Config::$graphImageType; if (!file_exists($filename)) { // Add enclosing quotes if needed @@ -163,7 +156,23 @@ try { $item = '"'.$item.'"'; } } - shell_exec(Webgrind_Config::$pythonExecutable.' library/gprof2dot.py -n '.$showFraction.' -f callgrind '.Webgrind_Config::xdebugOutputDir().''.$dataFile.' | '.Webgrind_Config::$dotExecutable.' -T'.Webgrind_Config::$graphImageType.' -o ' . $filename); + shell_exec(Webgrind_Config::$pythonExecutable.' library/gprof2dot.py -n '.$showFraction + .' -f callgrind '.Webgrind_Config::xdebugOutputDir().$dataFile.' | ' + .Webgrind_Config::$dotExecutable.' -T'.Webgrind_Config::$graphImageType.' -o '.$filename); + } + + if (!file_exists($filename)) { + $file = $filename; + $message = 'Unable to generate <u>'.$file.'</u> via python: <u>'.Webgrind_Config::$pythonExecutable + .'</u> and dot: <u>'.Webgrind_Config::$dotExecutable.'</u>. Please update config.php.'; + require 'templates/fileviewer.phtml'; + break; + } + + if (Webgrind_Config::$graphImageType == 'svg') { + header('Content-Type: image/svg+xml'); + } else { + header('Content-Type: image/'.Webgrind_Config::$graphImageType); } readfile($filename); break; |