Patch applied + modified from RaspAP/raspap-insiders#242

This commit is contained in:
billz
2023-11-20 14:45:55 +00:00
parent 2151a44729
commit ba45daad19
10 changed files with 220 additions and 4 deletions

View File

@@ -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;
}