display message when search returns zero rows
[phpmyadmin/dkf.git] / libraries / import / upload / uploadprogress.php
blobcc7eb271d9d0fbd4b30def7abc2d44208bb0399d
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package phpMyAdmin
6 */
7 if (! defined('PHPMYADMIN')) {
8 exit;
11 $ID_KEY = "UPLOAD_IDENTIFIER";
13 /**
14 * Returns upload status.
16 * This is implementation for uploadprogress extension.
18 function PMA_getUploadStatus($id) {
19 global $SESSION_KEY;
20 global $ID_KEY;
22 if (trim($id) == "") {
23 return;
26 if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
27 $_SESSION[$SESSION_KEY][$id] = array(
28 'id' => $id,
29 'finished' => false,
30 'percent' => 0,
31 'total' => 0,
32 'complete' => 0,
33 'plugin' => $ID_KEY
36 $ret = $_SESSION[$SESSION_KEY][$id];
38 if (! PMA_import_uploadprogressCheck() || $ret['finished']) {
39 return $ret;
42 $status = uploadprogress_get_info($id);
44 if ($status) {
45 if ($status['bytes_uploaded'] == $status['bytes_total']) {
46 $ret['finished'] = true;
47 } else {
48 $ret['finished'] = false;
50 $ret['total'] = $status['bytes_total'];
51 $ret['complete'] = $status['bytes_uploaded'];
53 if ($ret['total'] > 0) {
54 $ret['percent'] = $ret['complete'] / $ret['total'] * 100;
56 } else {
57 $ret = array(
58 'id' => $id,
59 'finished' => true,
60 'percent' => 100,
61 'total' => $ret['total'],
62 'complete' => $ret['total'],
63 'plugin' => $ID_KEY
67 $_SESSION[$SESSION_KEY][$id] = $ret;
69 return $ret;