tbl_indexes.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Displays index edit/creation form and handles it
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. use PhpMyAdmin\Controllers\Table\TableIndexesController;
  9. use PhpMyAdmin\Di\Container;
  10. use PhpMyAdmin\Index;
  11. use PhpMyAdmin\Response;
  12. require_once 'libraries/common.inc.php';
  13. $container = Container::getDefaultContainer();
  14. $container->factory('PhpMyAdmin\Controllers\Table\TableIndexesController');
  15. $container->alias(
  16. 'TableIndexesController',
  17. 'PhpMyAdmin\Controllers\Table\TableIndexesController'
  18. );
  19. $container->set('PhpMyAdmin\Response', Response::getInstance());
  20. $container->alias('response', 'PhpMyAdmin\Response');
  21. /* Define dependencies for the concerned controller */
  22. $db = $container->get('db');
  23. $table = $container->get('table');
  24. $dbi = $container->get('dbi');
  25. if (!isset($_POST['create_edit_table'])) {
  26. include_once 'libraries/tbl_common.inc.php';
  27. }
  28. if (isset($_POST['index'])) {
  29. if (is_array($_POST['index'])) {
  30. // coming already from form
  31. $index = new Index($_POST['index']);
  32. } else {
  33. $index = $dbi->getTable($db, $table)->getIndex($_POST['index']);
  34. }
  35. } else {
  36. $index = new Index;
  37. }
  38. $dependency_definitions = array(
  39. "index" => $index
  40. );
  41. /** @var TableIndexesController $controller */
  42. $controller = $container->get('TableIndexesController', $dependency_definitions);
  43. $controller->indexAction();