Recognize alpha and rc versions in updates names

This commit is contained in:
Dmitriy Simushev 2014-11-28 11:45:00 +00:00
parent 80f5873d9a
commit e2d4ab3715
2 changed files with 3 additions and 3 deletions

View File

@ -100,7 +100,7 @@ class Updater
{ {
$current_version = $this->getDatabaseVersion(); $current_version = $this->getDatabaseVersion();
if (!preg_match("/^([0-9]{1,2}\.){2}[0-9]{1,2}(-beta\.[0-9]+)?$/", $current_version)) { if (!preg_match("/^([0-9]{1,2}\.){2}[0-9]{1,2}(-(alpha|beta|rc)\.[0-9]+)?$/", $current_version)) {
$this->errors[] = getlocal( $this->errors[] = getlocal(
'The current version ({0}) is unknown or wrong formated', 'The current version ({0}) is unknown or wrong formated',
array($current_version) array($current_version)

View File

@ -64,11 +64,11 @@ class Utils
foreach ($container_reflection->getMethods() as $method_reflection) { foreach ($container_reflection->getMethods() as $method_reflection) {
// Filter update methods // Filter update methods
$name = $method_reflection->getName(); $name = $method_reflection->getName();
if (preg_match("/^update([0-9]+)(?:Beta([0-9]+))?$/", $name, $matches)) { if (preg_match("/^update([0-9]+)(?:(Alpha|Beta|Rc)([0-9]+))?$/", $name, $matches)) {
$version = self::formatVersionId($matches[1]); $version = self::formatVersionId($matches[1]);
// Check if a beta version is defined. // Check if a beta version is defined.
if (!empty($matches[2])) { if (!empty($matches[2])) {
$version .= '-beta.' . $matches[2]; $version .= sprintf('-%s.%u', strtolower($matches[2]), $matches[3]);
} }
$updates[$version] = $name; $updates[$version] = $name;