mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Patch applied + modified from RaspAP/raspap-insiders#242
This commit is contained in:
@@ -899,3 +899,28 @@ function getCountryCodes($locale = 'en', $flag = true) {
|
||||
return $countryData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares the current release with the latest available release
|
||||
*
|
||||
* @param string $installed
|
||||
* @param string $latest
|
||||
* @return boolean
|
||||
*/
|
||||
function checkReleaseVersion($installed, $latest) {
|
||||
$installedArray = explode('.', $installed);
|
||||
$latestArray = explode('.', $latest);
|
||||
|
||||
// compare segments of the version number
|
||||
for ($i = 0; $i < max(count($installedArray), count($latestArray)); $i++) {
|
||||
$installedSegment = (int)($installedArray[$i] ?? 0);
|
||||
$latestSegment = (int)($latestArray[$i] ?? 0);
|
||||
|
||||
if ($installedSegment < $latestSegment) {
|
||||
return true;
|
||||
} elseif ($installedSegment > $latestSegment) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user