Skip to content

Commit

Permalink
[impr-OpenMage#866] Add Mage::getOpenMageVersion|Info()
Browse files Browse the repository at this point in the history
OpenMage follows Semantic Versioning 2.0.0
  • Loading branch information
Flyingmana authored and edannenberg committed Aug 24, 2020
1 parent 661cba1 commit 7045a69
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,41 @@ public static function getVersionInfo()
);
}

/**
* Gets the current OpenMage version string
* @link https://openmage.github.io/supported-versions.html
* @link https://semver.org/
*
* @return string
*/
public static function getOpenMageVersion()
{
$i = self::getOpenMageVersionInfo();
$versionString = "{$i['major']}.{$i['minor']}.{$i['patch']}-";
if ($i['stability'])
$versionString .= $i['stability'] . '.';
$versionString .= $i['number'];
return trim($versionString, '.-');
}

/**
* Gets the detailed OpenMage version information
* @link https://openmage.github.io/supported-versions.html
* @link https://semver.org/
*
* @return array
*/
public static function getOpenMageVersionInfo()
{
return array(
'major' => '19',
'minor' => '4',
'patch' => '0',
'stability' => '', // beta,alpha,rc
'number' => '', // 1,2,3,0.3.7,x.7.z.92 @see https://semver.org/#spec-item-9
);
}

/**
* Get current Magento edition
*
Expand Down

0 comments on commit 7045a69

Please sign in to comment.