code cleanup
This commit is contained in:
@@ -6,46 +6,50 @@
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
|
||||
if (!defined('PHPMYADMIN')) {
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$ID_KEY = 'APC_UPLOAD_PROGRESS';
|
||||
|
||||
function PMA_getUploadStatus($id) {
|
||||
global $SESSION_KEY;
|
||||
global $ID_KEY;
|
||||
global $SESSION_KEY;
|
||||
global $ID_KEY;
|
||||
|
||||
if (trim($id)=="")
|
||||
return;
|
||||
if (!array_key_exists($id, $_SESSION[$SESSION_KEY])) {
|
||||
$_SESSION[$SESSION_KEY][$id] = array(
|
||||
if (trim($id) == "") {
|
||||
return;
|
||||
}
|
||||
if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
|
||||
$_SESSION[$SESSION_KEY][$id] = array(
|
||||
'id' => $id,
|
||||
'finished' => false,
|
||||
'percent' => 0,
|
||||
'total' => 0,
|
||||
'complete' => 0,
|
||||
'plugin' => $ID_KEY
|
||||
);
|
||||
'plugin' => $ID_KEY
|
||||
);
|
||||
}
|
||||
$ret = $_SESSION[$SESSION_KEY][$id];
|
||||
|
||||
if (!PMA_import_apcCheck() || $ret['finished'])
|
||||
return $ret;
|
||||
if (! PMA_import_apcCheck() || $ret['finished']) {
|
||||
return $ret;
|
||||
}
|
||||
$status = apc_fetch('upload_' . $id);
|
||||
|
||||
if ($status) {
|
||||
$ret['finished'] = (bool)$status['done'];
|
||||
$ret['total'] = $status['total'];
|
||||
$ret['complete'] = $status['current'];
|
||||
$ret['finished'] = (bool)$status['done'];
|
||||
$ret['total'] = $status['total'];
|
||||
$ret['complete'] = $status['current'];
|
||||
|
||||
if ($ret['total'] > 0)
|
||||
$ret['percent'] = $ret['complete'] / $ret['total'] * 100;
|
||||
if ($ret['total'] > 0) {
|
||||
$ret['percent'] = $ret['complete'] / $ret['total'] * 100;
|
||||
}
|
||||
|
||||
if ($ret['percent']==100)
|
||||
$ret['finished']=(bool)true;
|
||||
if ($ret['percent'] == 100) {
|
||||
$ret['finished'] = (bool)true;
|
||||
}
|
||||
|
||||
$_SESSION[$SESSION_KEY][$id] = $ret;
|
||||
$_SESSION[$SESSION_KEY][$id] = $ret;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
@@ -6,31 +6,31 @@
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
|
||||
if (!defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$ID_KEY = 'noplugin';
|
||||
|
||||
function PMA_getUploadStatus($id) {
|
||||
global $SESSION_KEY;
|
||||
global $ID_KEY;
|
||||
global $SESSION_KEY;
|
||||
global $ID_KEY;
|
||||
|
||||
if (trim($id)=="")
|
||||
return;
|
||||
if (!array_key_exists($id, $_SESSION[$SESSION_KEY])) {
|
||||
$_SESSION[$SESSION_KEY][$id] = array(
|
||||
if (trim($id) == "") {
|
||||
return;
|
||||
}
|
||||
if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
|
||||
$_SESSION[$SESSION_KEY][$id] = array(
|
||||
'id' => $id,
|
||||
'finished' => false,
|
||||
'percent' => 0,
|
||||
'total' => 0,
|
||||
'complete' => 0,
|
||||
'plugin' => $ID_KEY
|
||||
);
|
||||
'plugin' => $ID_KEY
|
||||
);
|
||||
}
|
||||
$ret = $_SESSION[$SESSION_KEY][$id];
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -5,46 +5,50 @@
|
||||
* @version $Id$
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
if (!defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$ID_KEY = "UPLOAD_IDENTIFIER";
|
||||
|
||||
function PMA_getUploadStatus($id) {
|
||||
global $SESSION_KEY;
|
||||
global $ID_KEY;
|
||||
global $SESSION_KEY;
|
||||
global $ID_KEY;
|
||||
|
||||
if (trim($id)=="")
|
||||
return;
|
||||
if (trim($id) == "") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!array_key_exists($id, $_SESSION[$SESSION_KEY])) {
|
||||
$_SESSION[$SESSION_KEY][$id] = array(
|
||||
if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
|
||||
$_SESSION[$SESSION_KEY][$id] = array(
|
||||
'id' => $id,
|
||||
'finished' => false,
|
||||
'percent' => 0,
|
||||
'total' => 0,
|
||||
'complete' => 0,
|
||||
'plugin' => $ID_KEY
|
||||
);
|
||||
'plugin' => $ID_KEY
|
||||
);
|
||||
}
|
||||
$ret = $_SESSION[$SESSION_KEY][$id];
|
||||
|
||||
if (!PMA_import_uploadprogressCheck() || $ret['finished'])
|
||||
return $ret;
|
||||
if (! PMA_import_uploadprogressCheck() || $ret['finished']) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
$status = uploadprogress_get_info($id);
|
||||
|
||||
if ($status) {
|
||||
if ($status['bytes_uploaded']==$status['bytes_total'])
|
||||
$ret['finished'] = true;
|
||||
else
|
||||
$ret['finished'] = false;
|
||||
$ret['total'] = $status['bytes_total'];
|
||||
$ret['complete'] = $status['bytes_uploaded'];
|
||||
if ($status['bytes_uploaded'] == $status['bytes_total']) {
|
||||
$ret['finished'] = true;
|
||||
} else {
|
||||
$ret['finished'] = false;
|
||||
}
|
||||
$ret['total'] = $status['bytes_total'];
|
||||
$ret['complete'] = $status['bytes_uploaded'];
|
||||
|
||||
if ($ret['total'] > 0)
|
||||
$ret['percent'] = $ret['complete'] / $ret['total'] * 100;
|
||||
if ($ret['total'] > 0) {
|
||||
$ret['percent'] = $ret['complete'] / $ret['total'] * 100;
|
||||
}
|
||||
} else {
|
||||
$ret = array(
|
||||
'id' => $id,
|
||||
|
Reference in New Issue
Block a user