This commit is contained in:
TimZ99 2020-02-08 20:57:53 +01:00
parent e32977ffff
commit 51dbbf9510
No known key found for this signature in database
GPG Key ID: 4D8268DC68E8339D
1 changed files with 19 additions and 20 deletions

View File

@ -555,28 +555,27 @@ namespace {
// update last check date
psm_update_conf('last_update_check', time());
$latest = psm_curl_get(PSM_UPDATE_URL);
if ($latest['info'] === false || (int)$latest['info']['http_code'] >= 300) {
// error
return false;
}
// extract latest version from Github.
$githubInfo = json_decode($latest['exec']);
if (property_exists($githubInfo, 'tag_name') === false) {
// version not found
return false;
}
$tagName = $githubInfo->tag_name;
$latestVersion = str_replace('v', '', $tagName);
// check from old version ... maybe has reason but I don't think so ...
if (empty($latestVersion) === true || strlen($latestVersion) >= 15) {
// weird version
return false;
if ($latest['info'] === false || (int)$latest['info']['http_code'] >= 300) {
// error
return false;
}
// add latest version to database
psm_update_conf('version_update_check', $latestVersion);
// extract latest version from Github.
$githubInfo = json_decode($latest['exec']);
if (property_exists($githubInfo, 'tag_name') === false) {
// version not found
return false;
}
$tagName = $githubInfo->tag_name;
$latestVersion = str_replace('v', '', $tagName);
// check from old version ... maybe has reason but I don't think so ...
if (empty($latestVersion) === true || strlen($latestVersion) >= 15) {
// weird version
return false;
}
// add latest version to database
psm_update_conf('version_update_check', $latestVersion);
} else {
$latestVersion = psm_get_conf('version_update_check');
$latestVersion = psm_get_conf('version_update_check');
}
$current = psm_get_conf('version');