Remove dbi global from DatabaseInterface::load method
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
9089ffdbb0
commit
75fc2ed74f
@ -3152,12 +3152,8 @@ class DatabaseInterface implements DbalInterface
|
||||
*/
|
||||
public static function load(?DbiExtension $extension = null): self
|
||||
{
|
||||
global $dbi;
|
||||
|
||||
if ($extension !== null) {
|
||||
$dbi = new self($extension);
|
||||
|
||||
return $dbi;
|
||||
return new self($extension);
|
||||
}
|
||||
|
||||
if (! self::checkDbExtension('mysqli')) {
|
||||
@ -3174,9 +3170,7 @@ class DatabaseInterface implements DbalInterface
|
||||
);
|
||||
}
|
||||
|
||||
$dbi = new self(new DbiMysqli());
|
||||
|
||||
return $dbi;
|
||||
return new self(new DbiMysqli());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -348,7 +348,8 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
|
||||
ThemeManager::getInstance()->setThemeCookie();
|
||||
|
||||
$containerBuilder->set(DatabaseInterface::class, DatabaseInterface::load());
|
||||
$dbi = DatabaseInterface::load();
|
||||
$containerBuilder->set(DatabaseInterface::class, $dbi);
|
||||
$containerBuilder->setAlias('dbi', DatabaseInterface::class);
|
||||
|
||||
if (! empty($cfg['Server'])) {
|
||||
|
||||
5
url.php
5
url.php
@ -15,7 +15,7 @@ if (! defined('ROOT_PATH')) {
|
||||
// phpcs:enable
|
||||
}
|
||||
|
||||
global $containerBuilder;
|
||||
global $containerBuilder, $dbi;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
define('PMA_MINIMUM_COMMON', true);
|
||||
@ -24,7 +24,8 @@ define('PMA_MINIMUM_COMMON', true);
|
||||
require_once ROOT_PATH . 'libraries/common.inc.php';
|
||||
|
||||
// Load database service because services.php is not available here
|
||||
$containerBuilder->set(DatabaseInterface::class, DatabaseInterface::load());
|
||||
$dbi = DatabaseInterface::load();
|
||||
$containerBuilder->set(DatabaseInterface::class, $dbi);
|
||||
|
||||
// Only output the http headers
|
||||
$response = Response::getInstance();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user