diff --git a/export.php b/export.php index 3004dd5d4a..70aecccdbf 100644 --- a/export.php +++ b/export.php @@ -21,16 +21,16 @@ if (!defined('TESTSUITE')) { include_once 'libraries/zip.lib.php'; include_once 'libraries/plugin_interface.lib.php'; - //check if its the GET request to check export time out + //check if it's the GET request to check export time out if (isset($_GET['check_time_out'])) { - if(isset($_SESSION['pma_export_error'])) { + if (isset($_SESSION['pma_export_error'])) { $err = $_SESSION['pma_export_error']; unset($_SESSION['pma_export_error']); echo $err; } else { echo "success"; } - return; + exit; } /** * Sets globals from $_POST @@ -266,15 +266,21 @@ if (!defined('TESTSUITE')) { // We send fake headers to avoid browser timeout when buffering $time_start = time(); } + +/** + * Sets a session variable upon a possible fatal error during export + * + * @return void + */ function PMA_shutdown() { - $a = error_get_last(); - if ($a != null && strpos($a['message'], "execution time")) { - //writting in partially downloaded file for future reference of user - print_r($a); - //set session variable to check if there was error while exporting - $_SESSION['pma_export_error'] = $a['message']; - } + $a = error_get_last(); + if ($a != null && strpos($a['message'], "execution time")) { + //write in partially downloaded file for future reference of user + print_r($a); + //set session variable to check if there was error while exporting + $_SESSION['pma_export_error'] = $a['message']; + } } /** * Detect ob_gzhandler diff --git a/js/export.js b/js/export.js index 04901b1889..a16bd29221 100644 --- a/js/export.js +++ b/js/export.js @@ -216,7 +216,7 @@ function toggle_quick_or_custom() var time_out; function check_time_out(time_limit) { - //margin of one second to avoid race condition to set/access session variable + //margin of one second to avoid race condition to set/access session variable time_limit = time_limit + 1; var href = "export.php"; var params = { @@ -227,16 +227,16 @@ function check_time_out(time_limit) clearTimeout(time_out); time_out = setTimeout(function(){ $.get(href, params, function (data) { - if(data['message'] !== 'success') { + if (data['message'] !== 'success') { PMA_ajaxShowMessage( - '