TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Core\Utility\VersionNumberUtility Class Reference
Inheritance diagram for TYPO3\CMS\Core\Utility\VersionNumberUtility:
t3lib_utility_VersionNumber

Static Public Member Functions

static convertVersionNumberToInteger ($versionNumber)
 
static convertIntegerToVersionNumber ($versionInteger)
 
static splitVersionRange ($version)
 
static getNumericTypo3Version ()
 
static getCurrentTypo3Version ()
 
static convertVersionsStringToVersionNumbers ($versionsString)
 
static convertVersionStringToArray ($version)
 
static raiseVersionNumber ($raise, $version)
 

Detailed Description

This file is part of the TYPO3 CMS project.

It is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, either version 2 of the License, or any later version.

For the full copyright and license information, please read the LICENSE.txt file that was distributed with this source code.

The TYPO3 project - inspiring people to share! Class with helper functions for version number handling

Author
Susanne Moog typo3.nosp@m.@sus.nosp@m.anne-.nosp@m.moog.nosp@m..de

Definition at line 21 of file VersionNumberUtility.php.

Member Function Documentation

◆ convertIntegerToVersionNumber()

static TYPO3\CMS\Core\Utility\VersionNumberUtility::convertIntegerToVersionNumber (   $versionInteger)
static

Returns the three part version number (string) from an integer, eg 4012003 -> '4.12.3'

Parameters
integer$versionIntegerInteger representation of version number
Returns
string Version number as format x.x.x
Exceptions

Definition at line 41 of file VersionNumberUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\VersionNumberUtilityTest\convertIntegerToVersionNumberConvertsIntegerToVersionNumber(), and TYPO3\CMS\Core\Tests\Unit\Utility\VersionNumberUtilityTest\convertIntegerToVersionNumberConvertsOtherTypesAsIntegerToVersionNumber().

◆ convertVersionNumberToInteger()

◆ convertVersionsStringToVersionNumbers()

static TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionsStringToVersionNumbers (   $versionsString)
static

This function converts version range strings (like '4.2.0-4.4.99') to an array (like array('4.2.0', '4.4.99'). It also forces each version part to be between 0 and 999

Parameters
string$versionsString
Returns
array

Definition at line 115 of file VersionNumberUtility.php.

References TYPO3\CMS\Core\Utility\MathUtility\forceIntegerInRange(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

◆ convertVersionStringToArray()

static TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionStringToArray (   $version)
static

Parses the version number x.x.x and returns an array with the various parts. It also forces each … 0 to 999

Parameters
string$versionVersion code, x.x.x
Returns
array

Definition at line 140 of file VersionNumberUtility.php.

References $result, TYPO3\CMS\Core\Utility\MathUtility\forceIntegerInRange(), and TYPO3\CMS\Core\Utility\GeneralUtility\intExplode().

Referenced by TYPO3\CMS\Extensionmanager\Utility\Importer\ExtensionListUtility\loadIntoDatabase().

◆ getCurrentTypo3Version()

static TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version ( )
static

Wrapper function for TYPO3_version constant to make functions using the constant unit testable

Returns
string

Definition at line 103 of file VersionNumberUtility.php.

Referenced by TYPO3\CMS\Install\Service\CoreVersionService\getInstalledVersion().

◆ getNumericTypo3Version()

static TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version ( )
static

Removes -dev -alpha -beta -RC states (also without '-' prefix) from a version number and replaces them by .0 and normalizes to a three part version number

Returns
string

Definition at line 87 of file VersionNumberUtility.php.

References TYPO3\CMS\Core\Utility\MathUtility\forceIntegerInRange(), and TYPO3\CMS\Core\Utility\GeneralUtility\intExplode().

Referenced by TYPO3\CMS\Extensionmanager\Utility\DependencyUtility\checkTypo3Dependency(), and TYPO3\CMS\Extensionmanager\ViewHelpers\Typo3DependencyViewHelper\isVersionSuitable().

◆ raiseVersionNumber()

static TYPO3\CMS\Core\Utility\VersionNumberUtility::raiseVersionNumber (   $raise,
  $version 
)
static

Method to raise a version number

Parameters
string$raiseone of "main", "sub", "dev" - the version part to raise by one
string$version(like 4.1.20)
Returns
string
Exceptions

Definition at line 162 of file VersionNumberUtility.php.

References TYPO3\CMS\Core\Utility\MathUtility\forceIntegerInRange(), and TYPO3\CMS\Core\Utility\GeneralUtility\intExplode().

◆ splitVersionRange()

static TYPO3\CMS\Core\Utility\VersionNumberUtility::splitVersionRange (   $version)
static

Splits a version range into an array.

If a single version number is given, it is considered a minimum value. If a dash is found, the numbers left and right are considered as minimum and maximum. Empty values are allowed. If no version can be parsed "0.0.0" — "0.0.0" is the result

Parameters
string$versionA string with a version range.
Returns
array

Definition at line 64 of file VersionNumberUtility.php.