Skip to content

Commit f116c42

Browse files
Flyingmanaedannenberg
authored andcommitted
[impr-OpenMage#866] Add Mage::getOpenMageVersion|Info()
OpenMage follows Semantic Versioning 2.0.0
1 parent 661cba1 commit f116c42

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

app/Mage.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,44 @@ public static function getVersionInfo()
178178
);
179179
}
180180

181+
/**
182+
* Gets the current OpenMage version string
183+
* @link https://openmage.github.io/supported-versions.html
184+
* @link https://semver.org/
185+
*
186+
* @return string
187+
*/
188+
public static function getOpenMageVersion()
189+
{
190+
$i = self::getOpenMageVersionInfo();
191+
$versionString = "{$i['major']}.{$i['minor']}.{$i['patch']}";
192+
if ($i['stability'] || $i['number']) {
193+
$versionString .= '-';
194+
if ($i['stability'])
195+
$versionString .= $i['stability'] . '.';
196+
$versionString .= $i['number'];
197+
}
198+
return trim($versionString, '.-');
199+
}
200+
201+
/**
202+
* Gets the detailed OpenMage version information
203+
* @link https://openmage.github.io/supported-versions.html
204+
* @link https://semver.org/
205+
*
206+
* @return array
207+
*/
208+
public static function getOpenMageVersionInfo()
209+
{
210+
return array(
211+
'major' => '19',
212+
'minor' => '4',
213+
'patch' => '0',
214+
'stability' => '', // beta,alpha,rc
215+
'number' => '', // 1,2,3,0.3.7,x.7.z.92 @see https://semver.org/#spec-item-9
216+
);
217+
}
218+
181219
/**
182220
* Get current Magento edition
183221
*

0 commit comments

Comments
 (0)