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

@@ -6,7 +6,7 @@ if (!defined('RASPI_CONFIG')) {
$defaults = [
'RASPI_BRAND_TEXT' => 'RaspAP',
'RASPI_VERSION' => '3.0.1',
'RASPI_VERSION' => '2.9.9',
'RASPI_CONFIG_NETWORK' => RASPI_CONFIG.'/networking/defaults.json',
'RASPI_CONFIG_PROVIDERS' => 'config/vpn-providers.json',
'RASPI_ADMIN_DETAILS' => RASPI_CONFIG.'/raspap.auth',

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