Merge pull request #11379 from madhuracj/structureController
Create separate controllers from table and database structure pages
This commit is contained in:
commit
ba4eb9e538
@ -12,34 +12,26 @@ require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/db_common.inc.php';
|
||||
require_once 'libraries/db_info.inc.php';
|
||||
require_once 'libraries/di/Container.class.php';
|
||||
require_once 'libraries/controllers/StructureController.class.php';
|
||||
require_once 'libraries/controllers/DatabaseStructureController.class.php';
|
||||
|
||||
$container = DI\Container::getDefaultContainer();
|
||||
$container->factory('PMA\Controllers\StructureController');
|
||||
$container->factory('PMA\Controllers\DatabaseStructureController');
|
||||
$container->alias(
|
||||
'StructureController', 'PMA\Controllers\StructureController'
|
||||
'DatabaseStructureController', 'PMA\Controllers\DatabaseStructureController'
|
||||
);
|
||||
|
||||
global $db, $table, $pos, $db_is_system_schema, $total_num_tables, $tables,
|
||||
$num_tables, $tbl_is_view, $tbl_storage_engine, $table_info_num_rows, $tbl_collation, $showtable;
|
||||
global $db, $pos, $db_is_system_schema, $total_num_tables, $tables, $num_tables;
|
||||
/* Define dependencies for the concerned controller */
|
||||
$dependency_definitions = array(
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'type' => 'db',
|
||||
'url_query' => &$GLOBALS['url_query'],
|
||||
'pos' => $pos,
|
||||
'db_is_system_schema' => $db_is_system_schema,
|
||||
'num_tables' => $num_tables,
|
||||
'total_num_tables' => $total_num_tables,
|
||||
'tables' => $tables,
|
||||
'tbl_is_view' => $tbl_is_view,
|
||||
'tbl_storage_engine' => $tbl_storage_engine,
|
||||
'table_info_num_rows' => $table_info_num_rows,
|
||||
'tbl_collation' => $tbl_collation,
|
||||
'showtable' => $showtable
|
||||
);
|
||||
|
||||
/** @var Controllers\StructureController $controller */
|
||||
$controller = $container->get('StructureController', $dependency_definitions);
|
||||
/** @var Controllers\DatabaseStructureController $controller */
|
||||
$controller = $container->get('DatabaseStructureController', $dependency_definitions);
|
||||
$controller->indexAction();
|
||||
|
||||
39
libraries/controllers/DatabaseController.class.php
Normal file
39
libraries/controllers/DatabaseController.class.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Holds the PMA\DatabaseController
|
||||
*
|
||||
* @package PMA
|
||||
*/
|
||||
|
||||
namespace PMA\Controllers;
|
||||
|
||||
use PMA\DI\Container;
|
||||
|
||||
if (!defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'libraries/controllers/Controller.class.php';
|
||||
|
||||
/**
|
||||
* Handles database related logic
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
abstract class DatabaseController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var string $db
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->db = $this->container->get('db');
|
||||
}
|
||||
}
|
||||
1040
libraries/controllers/DatabaseStructureController.class.php
Normal file
1040
libraries/controllers/DatabaseStructureController.class.php
Normal file
File diff suppressed because it is too large
Load Diff
1253
libraries/controllers/TableStructureController.class.php
Normal file
1253
libraries/controllers/TableStructureController.class.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -14,27 +14,22 @@ require_once 'libraries/mysql_charsets.inc.php';
|
||||
require_once 'libraries/config/page_settings.class.php';
|
||||
require_once 'libraries/bookmark.lib.php';
|
||||
require_once 'libraries/di/Container.class.php';
|
||||
require_once 'libraries/controllers/StructureController.class.php';
|
||||
require_once 'libraries/controllers/TableStructureController.class.php';
|
||||
|
||||
$container = DI\Container::getDefaultContainer();
|
||||
$container->factory('PMA\Controllers\StructureController');
|
||||
$container->factory('PMA\Controllers\TableStructureController');
|
||||
$container->alias(
|
||||
'StructureController', 'PMA\Controllers\StructureController'
|
||||
'TableStructureController', 'PMA\Controllers\TableStructureController'
|
||||
);
|
||||
|
||||
global $db, $table, $pos, $db_is_system_schema, $total_num_tables, $tables,
|
||||
$num_tables, $tbl_is_view, $tbl_storage_engine, $table_info_num_rows, $tbl_collation, $showtable;
|
||||
global $db, $table, $db_is_system_schema, $tbl_is_view, $tbl_storage_engine,
|
||||
$table_info_num_rows, $tbl_collation, $showtable;
|
||||
/* Define dependencies for the concerned controller */
|
||||
$dependency_definitions = array(
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'type' => 'table',
|
||||
'url_query' => &$GLOBALS['url_query'],
|
||||
'pos' => $pos,
|
||||
'db_is_system_schema' => $db_is_system_schema,
|
||||
'num_tables' => $num_tables,
|
||||
'total_num_tables' => $total_num_tables,
|
||||
'tables' => $tables,
|
||||
'tbl_is_view' => $tbl_is_view,
|
||||
'tbl_storage_engine' => $tbl_storage_engine,
|
||||
'table_info_num_rows' => $table_info_num_rows,
|
||||
@ -42,6 +37,6 @@ $dependency_definitions = array(
|
||||
'showtable' => $showtable
|
||||
);
|
||||
|
||||
/** @var Controllers\StructureController $controller */
|
||||
$controller = $container->get('StructureController', $dependency_definitions);
|
||||
/** @var Controllers\TableStructureController $controller */
|
||||
$controller = $container->get('TableStructureController', $dependency_definitions);
|
||||
$controller->indexAction();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user