Skip to content

Commit

Permalink
Remove the setup/lib/common.inc.php file
Browse files Browse the repository at this point in the history
Inline the file contents into setup/index.php file.

Signed-off-by: Maurício Meneghini Fauth <[email protected]>
  • Loading branch information
MauricioFauth committed Oct 22, 2022
1 parent 93ed4b1 commit 3927021
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 78 deletions.
13 changes: 4 additions & 9 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,20 @@
use PhpMyAdmin\Core;
use PhpMyAdmin\Routing;

// phpcs:disable PSR1.Files.SideEffects
if (! defined('ROOT_PATH')) {
// phpcs:disable PSR1.Files.SideEffects
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
// phpcs:enable
}

define('PHPMYADMIN', true);
// phpcs:enable

if (PHP_VERSION_ID < 70205) {
die('<p>PHP 7.2.5+ is required.</p><p>Currently installed version is: ' . PHP_VERSION . '</p>');
}

// phpcs:disable PSR1.Files.SideEffects
define('PHPMYADMIN', true);
// phpcs:enable

require_once ROOT_PATH . 'libraries/constants.php';

/**
* Activate autoloader
*/
if (! @is_readable(AUTOLOAD_FILE)) {
die(
'<p>File <samp>' . AUTOLOAD_FILE . '</samp> missing or not readable.</p>'
Expand Down
2 changes: 1 addition & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14438,7 +14438,7 @@
<code>$serviceName</code>
</MixedAssignment>
</file>
<file src="setup/lib/common.inc.php">
<file src="setup/index.php">
<RedundantCast occurrences="1">
<code>(string) $GLOBALS['lang']</code>
</RedundantCast>
Expand Down
54 changes: 50 additions & 4 deletions setup/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,68 @@
declare(strict_types=1);

use PhpMyAdmin\Common;
use PhpMyAdmin\Config\ConfigFile;
use PhpMyAdmin\Controllers\Setup\MainController;
use PhpMyAdmin\Controllers\Setup\ShowConfigController;
use PhpMyAdmin\Controllers\Setup\ValidateController;
use PhpMyAdmin\Core;
use PhpMyAdmin\DatabaseInterface;

// phpcs:disable PSR1.Files.SideEffects
if (! defined('ROOT_PATH')) {
// phpcs:disable PSR1.Files.SideEffects
define('ROOT_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR);
// phpcs:enable
}

// phpcs:disable PSR1.Files.SideEffects
define('PHPMYADMIN', true);
// phpcs:enable

require ROOT_PATH . 'setup/lib/common.inc.php';
if (PHP_VERSION_ID < 70205) {
die('<p>PHP 7.2.5+ is required.</p><p>Currently installed version is: ' . PHP_VERSION . '</p>');
}

require_once ROOT_PATH . 'libraries/constants.php';

if (! @is_readable(AUTOLOAD_FILE)) {
die(
'<p>File <samp>' . AUTOLOAD_FILE . '</samp> missing or not readable.</p>'
. '<p>Most likely you did not run Composer to '
. '<a href="https://docs.phpmyadmin.net/en/latest/setup.html#installing-from-git">'
. 'install library files</a>.</p>'
);
}

require AUTOLOAD_FILE;

Common::run(true);

// use default error handler
restore_error_handler();

// Save current language in a cookie, since it was not set in Common::run().
$GLOBALS['config']->setCookie('pma_lang', (string) $GLOBALS['lang']);
$GLOBALS['config']->set('is_setup', true);

$GLOBALS['ConfigFile'] = new ConfigFile();
$GLOBALS['ConfigFile']->setPersistKeys(
[
'DefaultLang',
'ServerDefault',
'UploadDir',
'SaveDir',
'Servers/1/verbose',
'Servers/1/host',
'Servers/1/port',
'Servers/1/socket',
'Servers/1/auth_type',
'Servers/1/user',
'Servers/1/password',
]
);

$GLOBALS['dbi'] = DatabaseInterface::load();

// allows for redirection even after sending some data
ob_start();

$request = Common::getRequest();
$route = $request->getRoute();
Expand Down
64 changes: 0 additions & 64 deletions setup/lib/common.inc.php

This file was deleted.

0 comments on commit 3927021

Please sign in to comment.