Skip to content

Commit

Permalink
add function to get OpenMage version (#866)
Browse files Browse the repository at this point in the history
OpenMage follows Semantic Versioning 2.0.0
Also preparation for the first 19.4.0 Release
  • Loading branch information
Flyingmana authored Dec 9, 2019
1 parent 1e65616 commit 143b03d
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,49 @@ 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'] || $i['number'] ) {
$versionString .= "-";
if ( $i['stability'] && $i['number'] ) {
$versionString .= implode('.', [$i['stability'], $i['number']]);
} else {
$versionString .= implode('', [$i['stability'], $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 143b03d

Please sign in to comment.