You are here

function _install_get_version_info in Drupal 10

Same name and namespace in other branches
  1. 8 core/includes/install.core.inc \_install_get_version_info()
  2. 9 core/includes/install.core.inc \_install_get_version_info()

Extracts version information from a drupal core version string.

Parameters

string $version: Version info string (e.g., 8.0.0, 8.1.0, 8.0.0-dev, 8.0.0-unstable1, 8.0.0-alpha2, 8.0.0-beta3, 8.6.x, and 8.0.0-rc4).

Return value

array Associative array of version info:

  • major: Major version (e.g., "8").
  • minor: Minor version (e.g., "0").
  • patch: Patch version (e.g., "0").
  • extra: Extra version info (e.g., "alpha2").
  • extra_text: The text part of "extra" (e.g., "alpha").
  • extra_number: The number part of "extra" (e.g., "2").
4 calls to _install_get_version_info()
HelpTopicTranslatedTestBase::installParameters in core/modules/help_topics/tests/src/Functional/HelpTopicTranslatedTestBase.php
LocaleNonInteractiveDevInstallTest::getVersionStringToTest in core/modules/locale/tests/src/Functional/LocaleNonInteractiveDevInstallTest.php
LocaleNonInteractiveInstallTest::getVersionStringToTest in core/modules/locale/tests/src/Functional/LocaleNonInteractiveInstallTest.php
Gets the version string to use in the translation file.
_install_prepare_import in core/includes/install.core.inc
Tells the translation import process that Drupal core is installed.

File

core/includes/install.core.inc, line 1494
API functions for installing Drupal.

Code

function _install_get_version_info($version) {
  preg_match('/
    (
      (?P<major>[0-9]+)    # Major release number.
      \\.          # .
      (?P<minor>[0-9]+)    # Minor release number.
      \\.          # .
      (?P<patch>[0-9]+|x)  # Patch release number.
    )             #
    (             #
      -           # - separator for "extra" version information.
      (?P<extra>   #
        (?P<extra_text>[a-z]+)  # Release extra text (e.g., "alpha").
        (?P<extra_number>[0-9]*)  # Release extra number (no separator between text and number).
      )           #
      |           # OR no "extra" information.
    )
    /sx', $version, $matches);
  return $matches;
}