remove todo, after upgrade PHPExcel
[phpmyadmin/arisferyanto.git] / libraries / import / upload / apc.php
blobd997e2c22da740399be524e0dd5fbc5185ea1fd4
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
9 if (! defined('PHPMYADMIN')) {
10 exit;
13 $ID_KEY = 'APC_UPLOAD_PROGRESS';
15 function PMA_getUploadStatus($id) {
16 global $SESSION_KEY;
17 global $ID_KEY;
19 if (trim($id) == "") {
20 return;
22 if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
23 $_SESSION[$SESSION_KEY][$id] = array(
24 'id' => $id,
25 'finished' => false,
26 'percent' => 0,
27 'total' => 0,
28 'complete' => 0,
29 'plugin' => $ID_KEY
32 $ret = $_SESSION[$SESSION_KEY][$id];
34 if (! PMA_import_apcCheck() || $ret['finished']) {
35 return $ret;
37 $status = apc_fetch('upload_' . $id);
39 if ($status) {
40 $ret['finished'] = (bool)$status['done'];
41 $ret['total'] = $status['total'];
42 $ret['complete'] = $status['current'];
44 if ($ret['total'] > 0) {
45 $ret['percent'] = $ret['complete'] / $ret['total'] * 100;
48 if ($ret['percent'] == 100) {
49 $ret['finished'] = (bool)true;
52 $_SESSION[$SESSION_KEY][$id] = $ret;
55 return $ret;