1
0
mirror of https://github.com/phpmyadmin/phpmyadmin.git synced 2026-10-28 07:41:55 +03:00

Code cleanup

Signed-off-by: Marc Delisle <marc@infomarc.info>
This commit is contained in:
Marc Delisle
2013-12-19 06:26:18 -05:00
parent 7ff18f07bc
commit d3fc017131
3 changed files with 26 additions and 18 deletions

View File

@@ -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

View File

@@ -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(
'<div class="error">' +
PMA_messages.strTimeOutError +
'</div>',
false
'<div class="error">' +
PMA_messages.strTimeOutError +
'</div>',
false
);
}
});
},time_limit*1000);
}, time_limit * 1000);
}
AJAX.registerOnload('export.js', function () {

View File

@@ -413,7 +413,9 @@ $js_messages['strErrorOccurred'] = __(
$js_messages['strChangeReportSettings'] = __("Change Report Settings");
$js_messages['strShowReportDetails'] = __("Show Report Details");
$js_messages['strIgnore'] = __("Ignore");
$js_messages['strTimeOutError'] = __("Your export is incomplete, due to a low execution time limit at the PHP level");
$js_messages['strTimeOutError'] = __(
"Your export is incomplete, due to a low execution time limit at the PHP level"
);
echo "var PMA_messages = new Array();\n";
foreach ($js_messages as $name => $js_message) {
PMA_printJsValue("PMA_messages['" . $name . "']", $js_message);