Merge pull request #11379 from madhuracj/structureController

Create separate controllers from table and database structure pages
This commit is contained in:
Madhura Jayaratne 2015-08-10 16:21:49 +05:30
commit ba4eb9e538
5 changed files with 2345 additions and 26 deletions

View File

@ -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();

View 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');
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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();