2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Displays table structure infos like columns, indexes, size, rows
5 * and allows manipulation of indexes and columns
9 declare(strict_types
=1);
11 use PhpMyAdmin\Controllers\Table\StructureController
;
12 use PhpMyAdmin\DatabaseInterface
;
13 use Symfony\Component\DependencyInjection\Definition
;
15 if (! defined('ROOT_PATH')) {
16 define('ROOT_PATH', __DIR__
. DIRECTORY_SEPARATOR
);
19 global $db_is_system_schema, $tbl_is_view, $tbl_storage_engine;
20 global $table_info_num_rows, $tbl_collation, $showtable;
22 require_once ROOT_PATH
. 'libraries/common.inc.php';
24 /** @var DatabaseInterface $dbi */
25 $dbi = $containerBuilder->get('dbi');
27 /** @var string $db */
28 $db = $containerBuilder->getParameter('db');
30 /** @var string $table */
31 $table = $containerBuilder->getParameter('table');
34 $table_class_object = $dbi->getTable($db, $table);
35 $reread_info = $table_class_object->getStatusInfo(null, true);
36 $GLOBALS['showtable'] = $table_class_object->getStatusInfo(null, (isset($reread_info) && $reread_info ?
true : false));
37 if ($table_class_object->isView()) {
39 $tbl_storage_engine = __('View');
42 $tbl_storage_engine = $table_class_object->getStorageEngine();
44 $tbl_collation = $table_class_object->getCollation();
45 $table_info_num_rows = $table_class_object->getNumRows();
46 /* Define dependencies for the concerned controller */
47 $dependency_definitions = [
48 'db_is_system_schema' => $db_is_system_schema,
49 'tbl_is_view' => $tbl_is_view,
50 'tbl_storage_engine' => $tbl_storage_engine,
51 'table_info_num_rows' => $table_info_num_rows,
52 'tbl_collation' => $tbl_collation,
53 'showtable' => $GLOBALS['showtable'],
56 /** @var Definition $definition */
57 $definition = $containerBuilder->getDefinition(StructureController
::class);
58 $parameterBag = $containerBuilder->getParameterBag();
60 static function (string $parameterName, $value) use ($definition, $parameterBag) {
61 $definition->replaceArgument($parameterName, $parameterBag->escapeValue($value));
63 array_keys($dependency_definitions),
64 $dependency_definitions
67 /** @var StructureController $controller */
68 $controller = $containerBuilder->get(StructureController
::class);
69 $controller->indexAction($containerBuilder);