summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlpha <ngcoder@live.com>2015-11-19 14:16:11 -0500
committerAlpha <ngcoder@live.com>2015-11-19 14:17:14 -0500
commita74facec06094cdfb7c4c81a0f0daea00bc94b84 (patch)
tree817ceab8462a28959dbf117d2a4c238c8cf65398
parent699f55e207e3c7c12f2ee838a22002c430013796 (diff)
downloadwebgrind-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.php2
-rw-r--r--index.php25
2 files changed, 18 insertions, 9 deletions
diff --git a/config.php b/config.php
index 8171d93..df32da9 100644
--- a/config.php
+++ b/config.php
@@ -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.
diff --git a/index.php b/index.php
index 80a8f3d..fd432ba 100644
--- a/index.php
+++ b/index.php
@@ -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;