From 04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 9 Jan 2020 10:55:03 +0100 Subject: phpmyadmin working --- .../Plugins/Import/Upload/UploadProgress.php | 97 ++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 srcs/phpmyadmin/libraries/classes/Plugins/Import/Upload/UploadProgress.php (limited to 'srcs/phpmyadmin/libraries/classes/Plugins/Import/Upload/UploadProgress.php') diff --git a/srcs/phpmyadmin/libraries/classes/Plugins/Import/Upload/UploadProgress.php b/srcs/phpmyadmin/libraries/classes/Plugins/Import/Upload/UploadProgress.php new file mode 100644 index 0000000..13578e0 --- /dev/null +++ b/srcs/phpmyadmin/libraries/classes/Plugins/Import/Upload/UploadProgress.php @@ -0,0 +1,97 @@ + $id, + 'finished' => false, + 'percent' => 0, + 'total' => 0, + 'complete' => 0, + 'plugin' => UploadProgress::getIdKey(), + ]; + } + $ret = $_SESSION[$SESSION_KEY][$id]; + + if (! ImportAjax::progressCheck() || $ret['finished']) { + return $ret; + } + + $status = null; + if (function_exists('uploadprogress_get_info')) { + $status = uploadprogress_get_info($id); + } + + if ($status) { + if ($status['bytes_uploaded'] == $status['bytes_total']) { + $ret['finished'] = true; + } else { + $ret['finished'] = false; + } + $ret['total'] = $status['bytes_total']; + $ret['complete'] = $status['bytes_uploaded']; + + if ($ret['total'] > 0) { + $ret['percent'] = $ret['complete'] / $ret['total'] * 100; + } + } else { + $ret = [ + 'id' => $id, + 'finished' => true, + 'percent' => 100, + 'total' => $ret['total'], + 'complete' => $ret['total'], + 'plugin' => UploadProgress::getIdKey(), + ]; + } + + $_SESSION[$SESSION_KEY][$id] = $ret; + + return $ret; + } +} -- cgit