Move ServerRequest creation to common.inc.php
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
b63d2c48fe
commit
80e39b9b55
@ -10,9 +10,9 @@ if (! defined('ROOT_PATH')) {
|
||||
// phpcs:enable
|
||||
}
|
||||
|
||||
global $route, $containerBuilder;
|
||||
global $route, $containerBuilder, $request;
|
||||
|
||||
require_once ROOT_PATH . 'libraries/common.inc.php';
|
||||
|
||||
$dispatcher = Routing::getDispatcher();
|
||||
Routing::callControllerForRoute($route, $dispatcher, $containerBuilder);
|
||||
Routing::callControllerForRoute($request, $route, $dispatcher, $containerBuilder);
|
||||
|
||||
@ -9,7 +9,7 @@ use FastRoute\Dispatcher;
|
||||
use FastRoute\Dispatcher\GroupCountBased as DispatcherGroupCountBased;
|
||||
use FastRoute\RouteCollector;
|
||||
use FastRoute\RouteParser\Std as RouteParserStd;
|
||||
use PhpMyAdmin\Http\Factory\ServerRequestFactory;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use RuntimeException;
|
||||
|
||||
@ -153,11 +153,11 @@ class Routing
|
||||
* Call associated controller for a route using the dispatcher
|
||||
*/
|
||||
public static function callControllerForRoute(
|
||||
ServerRequest $request,
|
||||
string $route,
|
||||
Dispatcher $dispatcher,
|
||||
ContainerInterface $container
|
||||
): void {
|
||||
$request = ServerRequestFactory::createFromGlobals();
|
||||
$routeInfo = $dispatcher->dispatch($request->getMethod(), rawurldecode($route));
|
||||
|
||||
if ($routeInfo[0] === Dispatcher::NOT_FOUND) {
|
||||
|
||||
@ -34,6 +34,7 @@ use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\ErrorHandler;
|
||||
use PhpMyAdmin\Http\Factory\ServerRequestFactory;
|
||||
use PhpMyAdmin\LanguageManager;
|
||||
use PhpMyAdmin\Logging;
|
||||
use PhpMyAdmin\Message;
|
||||
@ -46,7 +47,7 @@ use PhpMyAdmin\SqlParser\Lexer;
|
||||
use PhpMyAdmin\ThemeManager;
|
||||
use PhpMyAdmin\Tracker;
|
||||
|
||||
global $containerBuilder, $errorHandler, $config, $server, $dbi;
|
||||
global $containerBuilder, $errorHandler, $config, $server, $dbi, $request;
|
||||
global $lang, $cfg, $isConfigLoading, $auth_plugin, $route, $theme;
|
||||
global $urlParams, $goto, $back, $db, $table, $sql_query, $token_mismatch;
|
||||
|
||||
@ -107,6 +108,8 @@ if (! defined('K_PATH_IMAGES')) {
|
||||
// phpcs:enable
|
||||
}
|
||||
|
||||
$request = ServerRequestFactory::createFromGlobals();
|
||||
|
||||
$route = Routing::getCurrentRoute();
|
||||
|
||||
if ($route === '/import-status') {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user