diff --git a/libraries/import/upload/apc.php b/libraries/import/upload/apc.php index d997e2c22..6b50aeb2a 100644 --- a/libraries/import/upload/apc.php +++ b/libraries/import/upload/apc.php @@ -12,10 +12,15 @@ if (! defined('PHPMYADMIN')) { $ID_KEY = 'APC_UPLOAD_PROGRESS'; +/** + * Returns upload status. + * + * This is implementation for APC extension. + */ function PMA_getUploadStatus($id) { global $SESSION_KEY; global $ID_KEY; - + if (trim($id) == "") { return; } @@ -30,7 +35,7 @@ function PMA_getUploadStatus($id) { ); } $ret = $_SESSION[$SESSION_KEY][$id]; - + if (! PMA_import_apcCheck() || $ret['finished']) { return $ret; } @@ -40,7 +45,7 @@ function PMA_getUploadStatus($id) { $ret['finished'] = (bool)$status['done']; $ret['total'] = $status['total']; $ret['complete'] = $status['current']; - + if ($ret['total'] > 0) { $ret['percent'] = $ret['complete'] / $ret['total'] * 100; } @@ -51,7 +56,7 @@ function PMA_getUploadStatus($id) { $_SESSION[$SESSION_KEY][$id] = $ret; } - + return $ret; } diff --git a/libraries/import/upload/noplugin.php b/libraries/import/upload/noplugin.php index af55d7681..b3baf70e1 100644 --- a/libraries/import/upload/noplugin.php +++ b/libraries/import/upload/noplugin.php @@ -12,10 +12,15 @@ if (! defined('PHPMYADMIN')) { $ID_KEY = 'noplugin'; +/** + * Returns upload status. + * + * This is implementation when no webserver support exists, so it returns just zeroes. + */ function PMA_getUploadStatus($id) { global $SESSION_KEY; global $ID_KEY; - + if (trim($id) == "") { return; } diff --git a/libraries/import/upload/uploadprogress.php b/libraries/import/upload/uploadprogress.php index b1530a90d..ce4c4769d 100644 --- a/libraries/import/upload/uploadprogress.php +++ b/libraries/import/upload/uploadprogress.php @@ -11,14 +11,19 @@ if (! defined('PHPMYADMIN')) { $ID_KEY = "UPLOAD_IDENTIFIER"; +/** + * Returns upload status. + * + * This is implementation for uploadprogress extension. + */ function PMA_getUploadStatus($id) { global $SESSION_KEY; global $ID_KEY; - + if (trim($id) == "") { return; } - + if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) { $_SESSION[$SESSION_KEY][$id] = array( 'id' => $id, @@ -30,11 +35,11 @@ function PMA_getUploadStatus($id) { ); } $ret = $_SESSION[$SESSION_KEY][$id]; - + if (! PMA_import_uploadprogressCheck() || $ret['finished']) { return $ret; } - + $status = uploadprogress_get_info($id); if ($status) { @@ -45,7 +50,7 @@ function PMA_getUploadStatus($id) { } $ret['total'] = $status['bytes_total']; $ret['complete'] = $status['bytes_uploaded']; - + if ($ret['total'] > 0) { $ret['percent'] = $ret['complete'] / $ret['total'] * 100; } @@ -59,9 +64,9 @@ function PMA_getUploadStatus($id) { 'plugin' => $ID_KEY ); } - + $_SESSION[$SESSION_KEY][$id] = $ret; - + return $ret; } ?>