SchemaExportController.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. declare(strict_types=1);
  3. namespace PhpMyAdmin\Controllers;
  4. use PhpMyAdmin\Export;
  5. use PhpMyAdmin\Relation;
  6. use PhpMyAdmin\Util;
  7. /**
  8. * Schema export handler
  9. */
  10. class SchemaExportController
  11. {
  12. /** @var Export */
  13. private $export;
  14. /** @var Relation */
  15. private $relation;
  16. /**
  17. * @param Export $export A Export instance.
  18. * @param Relation $relation A Relation instance.
  19. */
  20. public function __construct(Export $export, Relation $relation)
  21. {
  22. $this->export = $export;
  23. $this->relation = $relation;
  24. }
  25. public function index(): void
  26. {
  27. global $cfgRelation;
  28. /**
  29. * get all variables needed for exporting relational schema
  30. * in $cfgRelation
  31. */
  32. $cfgRelation = $this->relation->getRelationsParam();
  33. if (! isset($_POST['export_type'])) {
  34. Util::checkParameters(['export_type']);
  35. }
  36. /**
  37. * Include the appropriate Schema Class depending on $export_type
  38. * default is PDF
  39. */
  40. $this->export->processExportSchema($_POST['export_type']);
  41. }
  42. }