error handling
This commit is contained in:
@@ -36,7 +36,9 @@ function PMA_chart_status($data)
|
|||||||
$chart = new PMA_pChart_Pie(
|
$chart = new PMA_pChart_Pie(
|
||||||
__('Query statistics'),
|
__('Query statistics'),
|
||||||
array_slice($chartData, 0, 20, true));
|
array_slice($chartData, 0, 20, true));
|
||||||
echo $chart->toString();
|
$chartCode = $chart->toString();
|
||||||
|
PMA_handle_chart_err($chart->getErrors());
|
||||||
|
echo $chartCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -54,7 +56,9 @@ function PMA_chart_profiling($data)
|
|||||||
$chart = new PMA_pChart_Pie(
|
$chart = new PMA_pChart_Pie(
|
||||||
__('Query execution time comparison (in microseconds)'),
|
__('Query execution time comparison (in microseconds)'),
|
||||||
$chartData);
|
$chartData);
|
||||||
echo $chart->toString();
|
$chartCode = $chart->toString();
|
||||||
|
PMA_handle_chart_err($chart->getErrors());
|
||||||
|
echo $chartCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -205,7 +209,13 @@ function PMA_chart_results($data, &$chartSettings)
|
|||||||
|
|
||||||
$chartCode = $chart->toString();
|
$chartCode = $chart->toString();
|
||||||
$chartSettings = $chart->getSettings();
|
$chartSettings = $chart->getSettings();
|
||||||
|
PMA_handle_chart_err($chart->getErrors());
|
||||||
return $chartCode;
|
return $chartCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function PMA_handle_chart_err($errors)
|
||||||
|
{
|
||||||
|
PMA_warnMissingExtension('GD', false, 'GD extension is needed for charts.');
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -71,6 +71,11 @@ class PMA_Chart
|
|||||||
*/
|
*/
|
||||||
private $userSpecifiedSettings = null;
|
private $userSpecifiedSettings = null;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Error codes will be stored here
|
||||||
|
*/
|
||||||
|
protected $errors = null;
|
||||||
|
|
||||||
function __construct($options = null)
|
function __construct($options = null)
|
||||||
{
|
{
|
||||||
$this->userSpecifiedSettings = $options;
|
$this->userSpecifiedSettings = $options;
|
||||||
@@ -133,6 +138,11 @@ class PMA_Chart
|
|||||||
{
|
{
|
||||||
return $this->settings;
|
return $this->settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getErrors()
|
||||||
|
{
|
||||||
|
return $this->errors;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -136,7 +136,8 @@ abstract class PMA_pChart_Chart extends PMA_Chart
|
|||||||
return '<img id="chart" src="data:image/png;base64,'.$this->imageEncoded.'" />';
|
return '<img id="chart" src="data:image/png;base64,'.$this->imageEncoded.'" />';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return __('GD library needed for chart is missing.');
|
$this->errors = 1; // stub
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user