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 upload progress
20 class UploadProgress
implements UploadInterface
23 * Gets the specific upload ID Key
25 * @return string ID Key
27 public static function getIdKey()
29 return 'UPLOAD_IDENTIFIER';
33 * Returns upload status.
35 * This is implementation for upload progress
37 * @param string $id upload id
41 public static function getUploadStatus($id)
45 if (trim($id) == "") {
49 if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
50 $_SESSION[$SESSION_KEY][$id] = array(
56 'plugin' => UploadProgress
::getIdKey()
59 $ret = $_SESSION[$SESSION_KEY][$id];
61 if (! PMA_import_progressCheck() ||
$ret['finished']) {
65 $status = uploadprogress_get_info($id);
68 if ($status['bytes_uploaded'] == $status['bytes_total']) {
69 $ret['finished'] = true;
71 $ret['finished'] = false;
73 $ret['total'] = $status['bytes_total'];
74 $ret['complete'] = $status['bytes_uploaded'];
76 if ($ret['total'] > 0) {
77 $ret['percent'] = $ret['complete'] / $ret['total'] * 100;
84 'total' => $ret['total'],
85 'complete' => $ret['total'],
86 'plugin' => UploadProgress
::getIdKey()
90 $_SESSION[$SESSION_KEY][$id] = $ret;