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