Get latest version from Github.
The latest version number will now come from Github instead of phpservermonitor.org.pull/668/head
parent
5c1d6d1f93
commit
f84061ee14
|
@ -476,17 +476,19 @@ function psm_update_available() {
|
||||||
// update last check date
|
// update last check date
|
||||||
psm_update_conf('last_update_check', time());
|
psm_update_conf('last_update_check', time());
|
||||||
$latest = psm_curl_get(PSM_UPDATE_URL);
|
$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
|
// add latest version to database
|
||||||
if ($latest !== false && strlen($latest) < 15) {
|
if ($latest[2] !== false && strlen($latest[2]) < 15) {
|
||||||
psm_update_conf('version_update_check', $latest);
|
psm_update_conf('version_update_check', $latest[2]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$latest = psm_get_conf('version_update_check');
|
$latest = psm_get_conf('version_update_check');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($latest !== false) {
|
if ($latest[2] !== false) {
|
||||||
$current = psm_get_conf('version');
|
$current = psm_get_conf('version');
|
||||||
return version_compare($latest, $current, '>');
|
return version_compare($latest[2], $current, '>');
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,13 +35,13 @@ define('PSM_VERSION', '3.4.4');
|
||||||
* URL to check for updates. Will not be checked if turned off on config page.
|
* URL to check for updates. Will not be checked if turned off on config page.
|
||||||
* @see psm_update_available()
|
* @see psm_update_available()
|
||||||
*/
|
*/
|
||||||
define('PSM_UPDATE_URL', 'http://www.phpservermonitor.org/version.php');
|
define('PSM_UPDATE_URL', 'https://api.github.com/repos/phpservermon/phpservermon/releases/latest');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default update interval (1 week). Only applicable when updates are enabled.
|
* Default update interval (1 day). Only applicable when updates are enabled.
|
||||||
* @see psm_update_available()
|
* @see psm_update_available()
|
||||||
*/
|
*/
|
||||||
define('PSM_UPDATE_INTERVAL', 7 * 24 * 60 * 60);
|
define('PSM_UPDATE_INTERVAL', 1 * 24 * 60 * 60);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration for: Hashing strength
|
* Configuration for: Hashing strength
|
||||||
|
|
|
@ -68,8 +68,7 @@
|
||||||
Powered by
|
Powered by
|
||||||
<a href="https://github.com/phpservermon/phpservermon/" target="_blank" rel="noopener">
|
<a href="https://github.com/phpservermon/phpservermon/" target="_blank" rel="noopener">
|
||||||
PHP Server Monitor {{ version }}.
|
PHP Server Monitor {{ version }}.
|
||||||
</a>
|
</a><span style="color:red;">{{ update_available|raw }}</span><a href="#" class="float-right">{{ label_back_to_top }}</a>
|
||||||
{{ update_available }} <a href="#" class="float-right">{{ label_back_to_top }}</a>
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
Loading…
Reference in New Issue