* Check for null version from upstream #575 * Fix for pre-release version numbering * Move popup to right * Split get/generate build ID #575
This commit is contained in:
@@ -76,7 +76,7 @@ class VersionService extends Service
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the latest version from github
|
||||
* Download the latest version from github and return the version number
|
||||
*/
|
||||
private function getLatestVersionGithub()
|
||||
{
|
||||
@@ -112,7 +112,7 @@ class VersionService extends Service
|
||||
);
|
||||
}
|
||||
|
||||
return $releases;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,12 +133,30 @@ class VersionService extends Service
|
||||
*/
|
||||
public function getBuildId($cfg)
|
||||
{
|
||||
return $cfg['build']['number'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a build ID
|
||||
*
|
||||
* @param array $cfg The version config
|
||||
*
|
||||
* @return false|string
|
||||
*/
|
||||
public function generateBuildId($cfg)
|
||||
{
|
||||
$date = date('ymd');
|
||||
exec($cfg['git']['git-local'], $version);
|
||||
if (empty($version)) {
|
||||
return $date;
|
||||
}
|
||||
|
||||
$version = substr($version[0], 0, $cfg['build']['length']);
|
||||
|
||||
// prefix with the date in YYMMDD format
|
||||
$date = date('ymd');
|
||||
return $date.'.'.$version;
|
||||
$version = $date.'.'.$version;
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,8 +183,9 @@ class VersionService extends Service
|
||||
if ($include_build) {
|
||||
// Get the current build id
|
||||
$build_number = $this->getBuildId($cfg);
|
||||
$cfg['build']['number'] = $build_number;
|
||||
$version = $version.'+'.$build_number;
|
||||
if (!empty($build_number)) {
|
||||
$version = $version.'+'.$build_number;
|
||||
}
|
||||
}
|
||||
|
||||
return $version;
|
||||
@@ -188,9 +207,12 @@ class VersionService extends Service
|
||||
}
|
||||
|
||||
// Replace "dev" with "alpha", since
|
||||
|
||||
$latest_version = $this->getLatestVersion();
|
||||
|
||||
if (empty($latest_version)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Convert to semver
|
||||
if ($this->isGreaterThan($latest_version, $current_version)) {
|
||||
$this->kvpRepo->save('new_version_available', true);
|
||||
|
||||
Reference in New Issue
Block a user