UploadNoplugin.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Provides upload functionalities for the import plugins
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. namespace PhpMyAdmin\Plugins\Import\Upload;
  9. use PhpMyAdmin\Plugins\UploadInterface;
  10. /**
  11. * Implementation for no plugin
  12. *
  13. * @package PhpMyAdmin
  14. */
  15. class UploadNoplugin implements UploadInterface
  16. {
  17. /**
  18. * Gets the specific upload ID Key
  19. *
  20. * @return string ID Key
  21. */
  22. public static function getIdKey()
  23. {
  24. return 'noplugin';
  25. }
  26. /**
  27. * Returns upload status.
  28. *
  29. * This is implementation when no webserver support exists,
  30. * so it returns just zeroes.
  31. *
  32. * @param string $id upload id
  33. *
  34. * @return array|null
  35. */
  36. public static function getUploadStatus($id)
  37. {
  38. global $SESSION_KEY;
  39. if (trim($id) == "") {
  40. return null;
  41. }
  42. if (!array_key_exists($id, $_SESSION[$SESSION_KEY])) {
  43. $_SESSION[$SESSION_KEY][$id] = array(
  44. 'id' => $id,
  45. 'finished' => false,
  46. 'percent' => 0,
  47. 'total' => 0,
  48. 'complete' => 0,
  49. 'plugin' => UploadNoplugin::getIdKey(),
  50. );
  51. }
  52. $ret = $_SESSION[$SESSION_KEY][$id];
  53. return $ret;
  54. }
  55. }