From 120f5ae847b7dd9ea9d588943bd2a9c46cdd3e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Mon, 7 Jul 2025 19:40:41 -0300 Subject: [PATCH] Remove PMA_PATH_TO_BASEDIR constant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's always an empty string. Signed-off-by: MaurĂ­cio Meneghini Fauth --- resources/templates/base.twig | 6 +++--- resources/templates/scripts.twig | 3 +-- src/Config.php | 5 ----- src/Header.php | 4 ---- src/Scripts.php | 9 +-------- tests/bootstrap-static.php | 7 ------- tests/unit/HeaderTest.php | 1 - tests/unit/ResponseRendererTest.php | 1 - 8 files changed, 5 insertions(+), 31 deletions(-) diff --git a/resources/templates/base.twig b/resources/templates/base.twig index 014a9fbfd1..615a686565 100644 --- a/resources/templates/base.twig +++ b/resources/templates/base.twig @@ -14,9 +14,9 @@ - - - + + + {{ header.title }} {{ header.scripts|raw }} diff --git a/resources/templates/scripts.twig b/resources/templates/scripts.twig index 2f31c19f92..70982f5e1a 100644 --- a/resources/templates/scripts.twig +++ b/resources/templates/scripts.twig @@ -1,6 +1,5 @@ {% for file in files %} - {% endfor %} diff --git a/src/Config.php b/src/Config.php index a40bb4b0fa..2472fd01a8 100644 --- a/src/Config.php +++ b/src/Config.php @@ -572,11 +572,6 @@ class Config $parts = array_slice($parts, 0, count($parts) - 1); } - /* Remove extra path from javascript calls */ - if (defined('PMA_PATH_TO_BASEDIR')) { - $parts = array_slice($parts, 0, count($parts) - 1); - } - // Add one more part to make the path end in slash unless it already ends with slash if (count($parts) < 2 || $parts[array_key_last($parts)] !== '') { $parts[] = ''; diff --git a/src/Header.php b/src/Header.php index a7cea51e90..fe1b0aaf6f 100644 --- a/src/Header.php +++ b/src/Header.php @@ -17,7 +17,6 @@ use PhpMyAdmin\Navigation\Navigation; use PhpMyAdmin\Theme\ThemeManager; use function array_merge; -use function defined; use function htmlspecialchars; use function ini_get; use function json_encode; @@ -209,8 +208,6 @@ class Header /** @return mixed[] */ public function getDisplay(): array { - $baseDir = defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; - /** @var ThemeManager $themeManager */ $themeManager = ContainerBuilder::getContainer()->get(ThemeManager::class); $theme = $themeManager->theme; @@ -278,7 +275,6 @@ class Header return [ 'lang' => Current::$lang, 'allow_third_party_framing' => $this->config->settings['AllowThirdPartyFraming'], - 'base_dir' => $baseDir, 'theme_path' => $theme->getPath(), 'server' => Current::$server, 'title' => $this->getPageTitle(), diff --git a/src/Scripts.php b/src/Scripts.php index 34f51fd6a2..0b4caa6f43 100644 --- a/src/Scripts.php +++ b/src/Scripts.php @@ -5,7 +5,6 @@ declare(strict_types=1); namespace PhpMyAdmin; use function array_key_exists; -use function defined; use function md5; use function str_contains; @@ -120,12 +119,6 @@ class Scripts */ public function getDisplay(): string { - $baseDir = defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; - - return $this->template->render('scripts', [ - 'base_dir' => $baseDir, - 'files' => $this->files, - 'code' => $this->code, - ]); + return $this->template->render('scripts', ['files' => $this->files, 'code' => $this->code]); } } diff --git a/tests/bootstrap-static.php b/tests/bootstrap-static.php index ef39642bab..8317d64720 100644 --- a/tests/bootstrap-static.php +++ b/tests/bootstrap-static.php @@ -23,10 +23,3 @@ if (! defined('TESTSUITE')) { include_once ROOT_PATH . 'examples/signon-script.php'; require_once ROOT_PATH . 'app/constants.php'; require_once AUTOLOAD_FILE; - -// phpcs:disable PSR1.Files.SideEffects -if (! defined('PMA_PATH_TO_BASEDIR')) { - define('PMA_PATH_TO_BASEDIR', ''); -} - -// phpcs:enable diff --git a/tests/unit/HeaderTest.php b/tests/unit/HeaderTest.php index c7aef92470..902821f1b0 100644 --- a/tests/unit/HeaderTest.php +++ b/tests/unit/HeaderTest.php @@ -90,7 +90,6 @@ class HeaderTest extends AbstractTestCase $expected = [ 'lang' => 'en', 'allow_third_party_framing' => false, - 'base_dir' => '', 'theme_path' => '', 'server' => 0, 'title' => 'phpMyAdmin', diff --git a/tests/unit/ResponseRendererTest.php b/tests/unit/ResponseRendererTest.php index aabb22315d..8f4b3f29a5 100644 --- a/tests/unit/ResponseRendererTest.php +++ b/tests/unit/ResponseRendererTest.php @@ -105,7 +105,6 @@ final class ResponseRendererTest extends AbstractTestCase 'header' => [ 'lang' => 'en', 'allow_third_party_framing' => false, - 'base_dir' => '', 'theme_path' => '', 'server' => 0, 'title' => 'phpMyAdmin',