Add EOL display and configurable option to Operating System and Environment page

This commit is contained in:
Ilia Ross
2024-04-10 23:37:47 +03:00
parent 613c568f4f
commit 7628a7329d
3 changed files with 25 additions and 2 deletions

View File

@@ -28,6 +28,18 @@ elsif ($in{'type'} ne $gconfig{'real_os_type'} ||
$in{'iversion'} || &error($text{'os_eiversion'});
$gconfig{'os_version'} = $in{'iversion'};
}
# EOL data
if (defined($in{'os_eol_before'}) &&
$in{'os_eol_before'} ne $gconfig{'os_eol_before'}) {
$in{'os_eol_before'} =~ /^\d+$/ || &error($text{'os_eol_ecountdown'});
$gconfig{'os_eol_before'} = $in{'os_eol_before'};
# Invalidate EOL cache
foreach my $key ('os_eol_none', 'os_eol_expired',
'os_eol_expiring', 'os_eol_last') {
delete($gconfig{$key});
}
}
# Path
$gconfig{'path'} = join($path_separator, split(/[\r\n]+/, $in{'path'}));
$gconfig{'syspath'} = !$in{'syspath'};
if ($gconfig{'ld_env'}) {

View File

@@ -35,6 +35,17 @@ if ($osinfo{'real_os_type'}) {
$osinfo{'os_version'} ne $gconfig{'os_version'} ?
"<br>".&ui_checkbox("update", 1, $text{'os_update'}) :
""), undef, [ "valign=middle","valign=middle" ]);
# Before EOL message is shown (months)
if ($gconfig{'os_eol'}) {
print &ui_table_row($text{'os_eol_type1'},
"$text{'os_eol_until'} $gconfig{'os_eol'}");
if ($gconfig{'os_ext_eol'}) {
print &ui_table_row($text{'os_eol_type2'},
"$text{'os_eol_until'} $gconfig{'os_ext_eol'}");
}
print &ui_table_row($text{'os_eol'},
&ui_textbox("os_eol_before", $gconfig{'os_eol_before'} // 3, 10)."&nbsp;$text{'os_eol_countdown'}");
}
}
else {
print &ui_table_row($text{'os_detect'},

View File

@@ -156,8 +156,8 @@ else {
my $expired = $eol_data->{'_eol_timestamp'} < time();
$eol_data->{'_expired'} = $text{'eol_reached'} if ($expired);
# Is expiring (in 6 months by default, unless configured otherwise)
my $os_eol_before = $gconfig{'os_eol_before'} // 6;
# Is expiring (in 3 months by default, unless configured otherwise)
my $os_eol_before = $gconfig{'os_eol_before'} // 3;
if (!$expired && $os_eol_before) {
my $expiring = $eol_data->{'_eol_timestamp'} < time() +
60*60*24*30*$os_eol_before ? 1 : 0;