Skip to content

Commit

Permalink
Move server collation entry point to routes.php
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Oct 26, 2019
1 parent 18dc296 commit 9372bae
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 29 deletions.
Expand Up @@ -68,7 +68,7 @@ public function __construct(
*
* @return string HTML
*/
public function indexAction(): string
public function index(): string
{
include_once ROOT_PATH . 'libraries/server_common.inc.php';

Expand Down
23 changes: 0 additions & 23 deletions libraries/entry_points/server/collations.php

This file was deleted.

9 changes: 5 additions & 4 deletions libraries/routes.php
Expand Up @@ -7,6 +7,7 @@

use FastRoute\RouteCollector;
use PhpMyAdmin\Controllers\Server\BinlogController;
use PhpMyAdmin\Controllers\Server\CollationsController;
use PhpMyAdmin\Controllers\Server\DatabasesController;
use PhpMyAdmin\Response;

Expand Down Expand Up @@ -138,20 +139,20 @@
$routes->addRoute(['GET', 'POST'], '/binlog', function () use ($containerBuilder, $response) {
/** @var BinlogController $controller */
$controller = $containerBuilder->get(BinlogController::class);

$response->addHTML($controller->index([
'log' => $_POST['log'] ?? null,
'pos' => $_POST['pos'] ?? null,
'is_full_query' => $_POST['is_full_query'] ?? null,
]));
});
$routes->addRoute('GET', '/collations', function () {
require_once ROOT_PATH . 'libraries/entry_points/server/collations.php';
$routes->addRoute('GET', '/collations', function () use ($containerBuilder, $response) {
/** @var CollationsController $controller */
$controller = $containerBuilder->get(CollationsController::class);
$response->addHTML($controller->index());
});
$routes->addGroup('/databases', function (RouteCollector $routes) use ($containerBuilder, $response) {
/** @var DatabasesController $controller */
$controller = $containerBuilder->get(DatabasesController::class);

$routes->addRoute(['GET', 'POST'], '', function () use ($response, $controller) {
$response->addHTML($controller->index([
'statistics' => $_REQUEST['statistics'] ?? null,
Expand Down
Expand Up @@ -50,7 +50,7 @@ public function testIndexAction(): void
new Template()
);

$actual = $controller->indexAction();
$actual = $controller->index();

$this->assertStringContainsString(
'<div id="div_mysql_charset_collations" class="row">',
Expand Down

0 comments on commit 9372bae

Please sign in to comment.