2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Provides upload functionalities for the import plugins
8 if (! defined('PHPMYADMIN')) {
12 /* Get the transformations interface */
13 require_once 'libraries/plugins/UploadInterface.int.php';
16 * Implementation for the APC extension
20 class UploadApc
implements UploadInterface
23 * Gets the specific upload ID Key
25 * @return string ID Key
27 public static function getIdKey()
29 return 'APC_UPLOAD_PROGRESS';
33 * Returns upload status.
35 * This is implementation for APC extension.
37 * @param string $id upload id
41 public static function getUploadStatus($id)
45 if (trim($id) == "") {
48 if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
49 $_SESSION[$SESSION_KEY][$id] = array(
55 'plugin' => UploadApc
::getIdKey()
58 $ret = $_SESSION[$SESSION_KEY][$id];
60 if (! PMA_import_apcCheck() ||
$ret['finished']) {
63 $status = apc_fetch('upload_' . $id);
66 $ret['finished'] = (bool)$status['done'];
67 $ret['total'] = $status['total'];
68 $ret['complete'] = $status['current'];
70 if ($ret['total'] > 0) {
71 $ret['percent'] = $ret['complete'] / $ret['total'] * 100;
74 if ($ret['percent'] == 100) {
75 $ret['finished'] = (bool)true;
78 $_SESSION[$SESSION_KEY][$id] = $ret;