From 88a7fb9ec116ad159d7cf7ee093298b5c0c44fc2 Mon Sep 17 00:00:00 2001 From: Allon Moritz Date: Thu, 19 Dec 2024 11:12:23 +0100 Subject: [PATCH 1/2] Remove the JPATH_PLATFORM constant --- build/phpstan/joomla-bootstrap.php | 1 - build/psr12/clean_errors.php | 4 ---- libraries/bootstrap.php | 8 -------- libraries/cms.php | 10 ---------- libraries/import.legacy.php | 10 ---------- libraries/import.php | 10 ---------- libraries/namespacemap.php | 2 +- tests/Unit/bootstrap.php | 7 ------- 8 files changed, 1 insertion(+), 51 deletions(-) diff --git a/build/phpstan/joomla-bootstrap.php b/build/phpstan/joomla-bootstrap.php index c285e232b6c25..21178069ab352 100644 --- a/build/phpstan/joomla-bootstrap.php +++ b/build/phpstan/joomla-bootstrap.php @@ -10,7 +10,6 @@ */ \define('_JEXEC', 1); -\define('JPATH_PLATFORM', 1); \define('JPATH_BASE', \dirname(__DIR__, 2)); // Load the Joomla environment diff --git a/build/psr12/clean_errors.php b/build/psr12/clean_errors.php index 257cd183d49f8..3db025ea466fd 100644 --- a/build/psr12/clean_errors.php +++ b/build/psr12/clean_errors.php @@ -40,10 +40,6 @@ "defined('_JEXEC') or die();", "\defined('_JEXEC') or die;", "defined('_JEXEC') or die;", - "\defined('JPATH_PLATFORM') or die();", - "defined('JPATH_PLATFORM') or die();", - "\defined('JPATH_PLATFORM') or die;", - "defined('JPATH_PLATFORM') or die;", "\defined('JPATH_BASE') or die();", "defined('JPATH_BASE') or die();", "\defined('JPATH_BASE') or die;", diff --git a/libraries/bootstrap.php b/libraries/bootstrap.php index 190240a730ee6..713e69ce985f9 100644 --- a/libraries/bootstrap.php +++ b/libraries/bootstrap.php @@ -10,14 +10,6 @@ defined('_JEXEC') or die; -/** - * Set the platform root path as a constant if necessary. - * - * @deprecated 4.4.0 will be removed in 6.0 - * Use defined('_JEXEC') or die; to detect if the CMS is loaded correctly - **/ -defined('JPATH_PLATFORM') or define('JPATH_PLATFORM', __DIR__); - // Detect the native operating system type. $os = strtoupper(substr(PHP_OS, 0, 3)); diff --git a/libraries/cms.php b/libraries/cms.php index 03f8203174b7b..b117d028f755d 100644 --- a/libraries/cms.php +++ b/libraries/cms.php @@ -18,16 +18,6 @@ E_USER_DEPRECATED ); -/** - * Set the platform root path as a constant if necessary. - * - * @deprecated 4.4.0 will be removed in 6.0 - * Use defined('_JEXEC') or die; to detect if the CMS is loaded correctly - **/ -if (!defined('JPATH_PLATFORM')) { - define('JPATH_PLATFORM', __DIR__); -} - // Import the library loader if necessary if (!class_exists('JLoader')) { require_once JPATH_LIBRARIES . '/loader.php'; diff --git a/libraries/import.legacy.php b/libraries/import.legacy.php index 60ea147aaa017..0a79a5d06722d 100644 --- a/libraries/import.legacy.php +++ b/libraries/import.legacy.php @@ -17,16 +17,6 @@ E_USER_DEPRECATED ); -/** - * Set the platform root path as a constant if necessary. - * - * @deprecated 4.4.0 will be removed in 6.0 - * Use defined('_JEXEC') or die; to detect if the CMS is loaded correctly - **/ -if (!defined('JPATH_PLATFORM')) { - define('JPATH_PLATFORM', __DIR__); -} - // Detect the native operating system type. $os = strtoupper(substr(PHP_OS, 0, 3)); diff --git a/libraries/import.php b/libraries/import.php index cc87ee797a32f..020761674cb8d 100644 --- a/libraries/import.php +++ b/libraries/import.php @@ -17,16 +17,6 @@ E_USER_DEPRECATED ); -/** - * Set the platform root path as a constant if necessary. - * - * @deprecated 4.4.0 will be removed in 6.0 - * Use defined('_JEXEC') or die; to detect if the CMS is loaded correctly - **/ -if (!defined('JPATH_PLATFORM')) { - define('JPATH_PLATFORM', __DIR__); -} - // Detect the native operating system type. $os = strtoupper(substr(PHP_OS, 0, 3)); diff --git a/libraries/namespacemap.php b/libraries/namespacemap.php index 9cb31ae86c345..7e7f58b4f0aca 100644 --- a/libraries/namespacemap.php +++ b/libraries/namespacemap.php @@ -145,7 +145,7 @@ protected function writeNamespaceFile($elements) $error_reporting = error_reporting(0); try { - File::write($this->file, implode("\n", $content)); + $b = implode("\n", $content);File::write($this->file, $b); } catch (Exception $e) { Log::add('Could not save ' . $this->file, Log::WARNING); diff --git a/tests/Unit/bootstrap.php b/tests/Unit/bootstrap.php index c506928078569..bc296b8d08349 100644 --- a/tests/Unit/bootstrap.php +++ b/tests/Unit/bootstrap.php @@ -35,13 +35,6 @@ \define('JPATH_ROOT', JPATH_BASE); } -/** - * @deprecated 4.4.0 will be removed in 6.0 - **/ -if (!\defined('JPATH_PLATFORM')) { - \define('JPATH_PLATFORM', JPATH_BASE . DIRECTORY_SEPARATOR . 'libraries'); -} - if (!\defined('JPATH_LIBRARIES')) { \define('JPATH_LIBRARIES', JPATH_BASE . DIRECTORY_SEPARATOR . 'libraries'); } From b7edaa54c2b5526e0db51e005557c730d1a4822a Mon Sep 17 00:00:00 2001 From: Allon Moritz Date: Thu, 19 Dec 2024 11:24:44 +0100 Subject: [PATCH 2/2] revert --- libraries/namespacemap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/namespacemap.php b/libraries/namespacemap.php index 7e7f58b4f0aca..9cb31ae86c345 100644 --- a/libraries/namespacemap.php +++ b/libraries/namespacemap.php @@ -145,7 +145,7 @@ protected function writeNamespaceFile($elements) $error_reporting = error_reporting(0); try { - $b = implode("\n", $content);File::write($this->file, $b); + File::write($this->file, implode("\n", $content)); } catch (Exception $e) { Log::add('Could not save ' . $this->file, Log::WARNING);