tbl_structure.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Displays table structure infos like columns, indexes, size, rows
  5. * and allows manipulation of indexes and columns
  6. *
  7. * @package PhpMyAdmin
  8. */
  9. use PhpMyAdmin\Controllers\Table\TableStructureController;
  10. use PhpMyAdmin\Di\Container;
  11. use PhpMyAdmin\Response;
  12. require_once 'libraries/common.inc.php';
  13. $container = Container::getDefaultContainer();
  14. $container->factory('PhpMyAdmin\Controllers\Table\TableStructureController');
  15. $container->alias(
  16. 'TableStructureController',
  17. 'PhpMyAdmin\Controllers\Table\TableStructureController'
  18. );
  19. $container->set('PhpMyAdmin\Response', Response::getInstance());
  20. $container->alias('response', 'PhpMyAdmin\Response');
  21. global $db, $table, $db_is_system_schema, $tbl_is_view, $tbl_storage_engine,
  22. $table_info_num_rows, $tbl_collation, $showtable;
  23. $GLOBALS['dbi']->selectDb($GLOBALS['db']);
  24. $table_class_object = $GLOBALS['dbi']->getTable(
  25. $GLOBALS['db'],
  26. $GLOBALS['table']
  27. );
  28. $reread_info = $table_class_object->getStatusInfo(null, true);
  29. $GLOBALS['showtable'] = $table_class_object->getStatusInfo(null, (isset($reread_info) && $reread_info ? true : false));
  30. if ($table_class_object->isView()) {
  31. $tbl_is_view = true;
  32. $tbl_storage_engine = __('View');
  33. } else {
  34. $tbl_is_view = false;
  35. $tbl_storage_engine = $table_class_object->getStorageEngine();
  36. }
  37. $tbl_collation = $table_class_object->getCollation();
  38. $table_info_num_rows = $table_class_object->getNumRows();
  39. /* Define dependencies for the concerned controller */
  40. $dependency_definitions = array(
  41. 'db' => $db,
  42. 'table' => $table,
  43. 'db_is_system_schema' => $db_is_system_schema,
  44. 'tbl_is_view' => $tbl_is_view,
  45. 'tbl_storage_engine' => $tbl_storage_engine,
  46. 'table_info_num_rows' => $table_info_num_rows,
  47. 'tbl_collation' => $tbl_collation,
  48. 'showtable' => $GLOBALS['showtable']
  49. );
  50. /** @var TableStructureController $controller */
  51. $controller = $container->get('TableStructureController', $dependency_definitions);
  52. $controller->indexAction();