Improve create-release script to handle QA branches higher than QA_4_8.
[phpmyadmin.git] / tbl_indexes.php
blob4ea846d97aa68731964895048448ad38f75cc7d2
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Displays index edit/creation form and handles it
6 * @package PhpMyAdmin
7 */
8 declare(strict_types=1);
10 use PhpMyAdmin\Controllers\Table\IndexesController;
11 use PhpMyAdmin\DatabaseInterface;
12 use PhpMyAdmin\Di\Container;
13 use PhpMyAdmin\Index;
14 use PhpMyAdmin\Response;
15 use Symfony\Component\DependencyInjection\Definition;
17 if (! defined('ROOT_PATH')) {
18 define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
21 require_once ROOT_PATH . 'libraries/common.inc.php';
23 $container = Container::getDefaultContainer();
24 $container->set(Response::class, Response::getInstance());
25 $container->alias('response', Response::class);
27 /* Define dependencies for the concerned controller */
28 $db = $container->get('db');
29 $table = $container->get('table');
31 /** @var DatabaseInterface $dbi */
32 $dbi = $container->get(DatabaseInterface::class);
34 if (! isset($_POST['create_edit_table'])) {
35 include_once ROOT_PATH . 'libraries/tbl_common.inc.php';
37 if (isset($_POST['index'])) {
38 if (is_array($_POST['index'])) {
39 // coming already from form
40 $index = new Index($_POST['index']);
41 } else {
42 $index = $dbi->getTable($db, $table)->getIndex($_POST['index']);
44 } else {
45 $index = new Index();
48 /* Define dependencies for the concerned controller */
49 $dependency_definitions = [
50 'db' => $container->get('db'),
51 'table' => $container->get('table'),
52 'index' => $index,
55 /** @var Definition $definition */
56 $definition = $containerBuilder->getDefinition(IndexesController::class);
57 array_map(
58 static function (string $parameterName, $value) use ($definition) {
59 $definition->replaceArgument($parameterName, $value);
61 array_keys($dependency_definitions),
62 $dependency_definitions
65 /** @var IndexesController $controller */
66 $controller = $containerBuilder->get(IndexesController::class);
67 $controller->indexAction();