From c5d2d51007bba0f612116a287493cd3b7fa9cc7d Mon Sep 17 00:00:00 2001 From: Mohamed Ashraf Date: Sat, 21 Sep 2013 00:42:00 +0200 Subject: [PATCH] Error reporting now fails gracefully on dev builds --- error_report.php | 24 +++++++++++++++++++++++- js/error_report.js | 6 +++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/error_report.php b/error_report.php index 9fc9e9643f..b0da4453ae 100644 --- a/error_report.php +++ b/error_report.php @@ -10,8 +10,30 @@ require_once 'libraries/error_report.lib.php'; $response = PMA_Response::getInstance(); +// Fail sgracefully if this is not a release version of phpMyAdmin +if(!$GLOBALS['PMA_Config']->isGitRevision()) { + $response->addJSON('message', PMA_Message::error( + __('An error has been detected however you seem to be running on a git ' + . 'version of phpMyAdmin.') + . __('Automatic report submission cannot be used. Please submit a ' + . 'manual error report on the bug tracker.') + . '
' + . __('You may want to refresh the page.'))); + $response->isSuccess(false); + exit; +} elseif (!defined('LINE_COUNTS')) { + $response->addJSON('message', PMA_Message::error( + __('An error has been detected however the js line counts file does not ' + . 'seam to exist in this phpMyAdmin installation. ') + . __('Automatic report submission cannot be used. Please submit a ' + . 'manual error report on the bug tracker.') + . '
' + . __('You may want to refresh the page.'))); + $response->isSuccess(false); + exit; +} + if ($_REQUEST['send_error_report'] == true) { - $response->addJSON('test', PMA_sendErrorReport(PMA_getReportData(false))); if ($_REQUEST['automatic'] === "true") { $response->addJSON('message', PMA_Message::error( __('An error has been detected and an error report has been ' diff --git a/js/error_report.js b/js/error_report.js index ad78585a9b..2d4c54c3c0 100644 --- a/js/error_report.js +++ b/js/error_report.js @@ -21,7 +21,11 @@ var ErrorReport = { token: PMA_commonParams.get('token'), get_settings: true, }, function(data) { - if(data.report_setting == "ask") { + if (!data.success === true) { + PMA_ajaxShowMessage(data.error, false); + return; + } + if (data.report_setting == "ask") { ErrorReport._showErrorNotification(); } else if(data.report_setting == "always") { report_data = ErrorReport._get_report_data(exception);