Commit bb927efe authored by Christian Kuhn's avatar Christian Kuhn Committed by Benni Mack
Browse files

[!!!][TASK] Remove constants TYPO3_version and TYPO3_branch

Global constants TYPO3_version and TYPO3_branch have
been deprecated with introduction of class
\TYPO3\CMS\Core\Information\Typo3Version in v9.5.15
and are removed together with some last usages.

Resolves: #96523
Related: #96107
Releases: main
Change-Id: I0fd90a9f913d83a555a9744117f76d63468a1048
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/73000

Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 7b5c2d29
......@@ -23,6 +23,7 @@ use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\UserAspect;
use TYPO3\CMS\Core\Context\WorkspaceAspect;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Log\Logger;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
......@@ -320,10 +321,11 @@ class ConditionMatcherTest extends FunctionalTestCase
*/
public function compatVersionConditionMatchesSameRelease(): void
{
$typo3Version = new Typo3Version();
$subject = $this->getConditionMatcher();
self::assertTrue($subject->match('[compatVersion(' . TYPO3_branch . ')]'));
self::assertTrue($subject->match('[compatVersion("' . TYPO3_branch . '")]'));
self::assertTrue($subject->match('[compatVersion(\'' . TYPO3_branch . '\')]'));
self::assertTrue($subject->match('[compatVersion(' . $typo3Version->getBranch() . ')]'));
self::assertTrue($subject->match('[compatVersion("' . $typo3Version->getBranch() . '")]'));
self::assertTrue($subject->match('[compatVersion(\'' . $typo3Version->getBranch() . '\')]'));
}
/**
......
......@@ -21,6 +21,7 @@ use Symfony\Component\ExpressionLanguage\ExpressionFunction;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
use TYPO3\CMS\Core\Configuration\Features;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\Exception\MissingArrayPathException;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -73,7 +74,8 @@ class DefaultFunctionsProvider implements ExpressionFunctionProviderInterface
// Not implemented, we only use the evaluator
},
static function ($arguments, $str) {
return VersionNumberUtility::convertVersionNumberToInteger(TYPO3_branch) >=
$typo3Version = GeneralUtility::makeInstance(Typo3Version::class);
return VersionNumberUtility::convertVersionNumberToInteger($typo3Version->getBranch()) >=
VersionNumberUtility::convertVersionNumberToInteger($str);
}
);
......
......@@ -22,19 +22,6 @@ class Typo3Version
protected const VERSION = '12.0.0-dev';
protected const BRANCH = '12.0';
/**
* Define constants used up until TYPO3 v10, this constructor can be removed in TYPO3 v12.
*/
public function __construct()
{
if (!defined('TYPO3_version')) {
define('TYPO3_version', $this->getVersion());
}
if (!defined('TYPO3_branch')) {
define('TYPO3_branch', $this->getBranch());
}
}
public function getVersion(): string
{
return static::VERSION;
......
......@@ -60,8 +60,8 @@ class VersionNumberUtility
}
/**
* Wrapper function for TYPO3_version constant to make functions using
* the constant unit testable
* Wrapper function for the static TYPO3 version to
* make functions using the constant unit testable.
*
* @return string
*/
......
......@@ -306,6 +306,7 @@ The following TypoScript options have been removed or adapted:
The following constants have been dropped:
- :php:`TYPO3_branch`
- :php:`TYPO3_MODE`
- :php:`TYPO3_REQUESTTYPE`
- :php:`TYPO3_REQUESTTYPE_AJAX`
......@@ -313,6 +314,7 @@ The following constants have been dropped:
- :php:`TYPO3_REQUESTTYPE_CLI`
- :php:`TYPO3_REQUESTTYPE_FE`
- :php:`TYPO3_REQUESTTYPE_INSTALL`
- :php:`TYPO3_version`
The following class constants have been dropped:
......
......@@ -27,6 +27,7 @@ use TYPO3\CMS\Core\Context\WorkspaceAspect;
use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Routing\PageArguments;
use TYPO3\CMS\Core\Site\Entity\Site;
use TYPO3\CMS\Core\TypoScript\TemplateService;
......@@ -357,7 +358,8 @@ class ConditionMatcherTest extends FunctionalTestCase
*/
public function compatVersionConditionMatchesSameRelease(): void
{
self::assertTrue($this->getConditionMatcher()->match('[compatVersion(' . TYPO3_branch . ')]'));
$typo3Version = new Typo3Version();
self::assertTrue($this->getConditionMatcher()->match('[compatVersion(' . $typo3Version->getBranch() . ')]'));
}
/**
......
......@@ -264,7 +264,7 @@ class InstallStatusReport implements StatusProviderInterface
// - no ELTS update was released, yet
$message = sprintf(
$languageService->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_elts_information'),
TYPO3_version,
$typoVersion->getVersion(),
'<a href="https://typo3.com/elts" target="_blank" rel="noopener">https://typo3.com/elts</a>'
);
$status = Status::WARNING;
......
......@@ -184,11 +184,13 @@ return [
'TYPO3_version' => [
'restFiles' => [
'Deprecation-90007-GlobalConstantsTYPO3_versionAndTYPO3_branch.rst',
'Breaking-96107-DeprecatedFunctionalityRemoved.rst',
],
],
'TYPO3_branch' => [
'restFiles' => [
'Deprecation-90007-GlobalConstantsTYPO3_versionAndTYPO3_branch.rst',
'Breaking-96107-DeprecatedFunctionalityRemoved.rst',
],
],
'TYPO3_copyright_year' => [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment