2 /* vim: set expandtab sw=4 ts=4 sts=4: */
9 if (! defined('PHPMYADMIN')) {
13 $ID_KEY = 'APC_UPLOAD_PROGRESS';
16 * Returns upload status.
18 * This is implementation for APC extension.
20 function PMA_getUploadStatus($id) {
24 if (trim($id) == "") {
27 if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
28 $_SESSION[$SESSION_KEY][$id] = array(
37 $ret = $_SESSION[$SESSION_KEY][$id];
39 if (! PMA_import_apcCheck() ||
$ret['finished']) {
42 $status = apc_fetch('upload_' . $id);
45 $ret['finished'] = (bool)$status['done'];
46 $ret['total'] = $status['total'];
47 $ret['complete'] = $status['current'];
49 if ($ret['total'] > 0) {
50 $ret['percent'] = $ret['complete'] / $ret['total'] * 100;
53 if ($ret['percent'] == 100) {
54 $ret['finished'] = (bool)true;
57 $_SESSION[$SESSION_KEY][$id] = $ret;