2 /* vim: set expandtab sw=4 ts=4 sts=4: */
8 if (! defined('PHPMYADMIN')) {
12 $ID_KEY = 'APC_UPLOAD_PROGRESS';
15 * Returns upload status.
17 * This is implementation for APC extension.
22 function PMA_getUploadStatus($id)
27 if (trim($id) == "") {
30 if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
31 $_SESSION[$SESSION_KEY][$id] = array(
40 $ret = $_SESSION[$SESSION_KEY][$id];
42 if (! PMA_import_apcCheck() ||
$ret['finished']) {
45 $status = apc_fetch('upload_' . $id);
48 $ret['finished'] = (bool)$status['done'];
49 $ret['total'] = $status['total'];
50 $ret['complete'] = $status['current'];
52 if ($ret['total'] > 0) {
53 $ret['percent'] = $ret['complete'] / $ret['total'] * 100;
56 if ($ret['percent'] == 100) {
57 $ret['finished'] = (bool)true;
60 $_SESSION[$SESSION_KEY][$id] = $ret;