commit
11d2d4bba8
|
@ -555,22 +555,31 @@ namespace {
|
|||
// update last check date
|
||||
psm_update_conf('last_update_check', time());
|
||||
$latest = psm_curl_get(PSM_UPDATE_URL);
|
||||
// extract latest version from Github.
|
||||
preg_match('/"tag_name":"[v](([\d][.][\d][.][\d])(-?\w*))"/', $latest, $latest);
|
||||
// add latest version to database
|
||||
if (!empty($latest) && strlen($latest[2]) < 15) {
|
||||
psm_update_conf('version_update_check', $latest[2]);
|
||||
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;
|
||||
}
|
||||
// add latest version to database
|
||||
psm_update_conf('version_update_check', $latestVersion);
|
||||
} else {
|
||||
$latest[2] = psm_get_conf('version_update_check');
|
||||
$latestVersion = psm_get_conf('version_update_check');
|
||||
}
|
||||
|
||||
if (!empty($latest)) {
|
||||
$current = psm_get_conf('version');
|
||||
return version_compare($latest[2], $current, '>');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
$current = psm_get_conf('version');
|
||||
return version_compare($latestVersion, $current, '>');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue