Merge pull request #16987 from mauriciofauth/minimum-common

Remove `PMA_MINIMUM_COMMON` constant
This commit is contained in:
Maurício Meneghini Fauth 2021-07-02 09:23:44 -03:00 committed by GitHub
commit 91c18ef3c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 15 deletions

View File

@ -22,8 +22,8 @@ header('Content-Type: text/javascript; charset=UTF-8');
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600) . ' GMT');
// Avoid loading the full common.inc.php because this would add many non-js-compatible stuff like DOCTYPE.
$isMinimumCommon = true;
// phpcs:disable PSR1.Files.SideEffects
define('PMA_MINIMUM_COMMON', true);
define('PMA_PATH_TO_BASEDIR', '../');
define('PMA_NO_SESSION', true);
// phpcs:enable

View File

@ -532,6 +532,8 @@ class Config
*/
public function loadUserPreferences(): void
{
global $isMinimumCommon;
$userPreferences = new UserPreferences();
// index.php should load these settings, so that phpmyadmin.css.php
// will have everything available in session cache
@ -539,7 +541,7 @@ class Config
? $GLOBALS['cfg']['ServerDefault']
: 0);
$cache_key = 'server_' . $server;
if ($server > 0 && ! defined('PMA_MINIMUM_COMMON')) {
if ($server > 0 && ! isset($isMinimumCommon)) {
$config_mtime = max($this->defaultSourceMtime, $this->sourceMtime);
// cache user preferences, use database only when needed
if (
@ -575,7 +577,8 @@ class Config
// load config array
$this->settings = array_replace_recursive($this->settings, $config_data);
$GLOBALS['cfg'] = array_replace_recursive($GLOBALS['cfg'], $config_data);
if (defined('PMA_MINIMUM_COMMON')) {
if (isset($isMinimumCommon)) {
return;
}

View File

@ -110,9 +110,7 @@ if (! defined('K_PATH_IMAGES')) {
$route = Routing::getCurrentRoute();
if ($route === '/import-status') {
// phpcs:disable PSR1.Files.SideEffects
define('PMA_MINIMUM_COMMON', true);
// phpcs:enable
$isMinimumCommon = true;
}
$containerBuilder = Core::getContainerBuilder();
@ -238,7 +236,7 @@ $theme = ThemeManager::initializeTheme();
/** @var DatabaseInterface $dbi */
$dbi = null;
if (defined('PMA_MINIMUM_COMMON')) {
if (isset($isMinimumCommon)) {
$config->loadUserPreferences();
$containerBuilder->set('theme_manager', ThemeManager::getInstance());
Tracker::enable();

View File

@ -8,22 +8,20 @@ declare(strict_types=1);
use PhpMyAdmin\Config\ConfigFile;
use PhpMyAdmin\DatabaseInterface;
// phpcs:disable PSR1.Files.SideEffects
define('PMA_MINIMUM_COMMON', true);
// phpcs:enable
chdir('..');
if (! file_exists(ROOT_PATH . 'libraries/common.inc.php')) {
die('Bad invocation!');
}
$isMinimumCommon = true;
require_once ROOT_PATH . 'libraries/common.inc.php';
// use default error handler
restore_error_handler();
// Save current language in a cookie, required since we use PMA_MINIMUM_COMMON
// Save current language in a cookie, required since we set $isMinimumCommon
$GLOBALS['config']->setCookie('pma_lang', (string) $GLOBALS['lang']);
$GLOBALS['config']->set('is_setup', true);

View File

@ -18,9 +18,7 @@ if (! defined('ROOT_PATH')) {
global $containerBuilder, $dbi;
// phpcs:disable PSR1.Files.SideEffects
define('PMA_MINIMUM_COMMON', true);
// phpcs:enable
$isMinimumCommon = true;
require_once ROOT_PATH . 'libraries/common.inc.php';