mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Record last config change and restart times
This commit is contained in:
@@ -17,6 +17,8 @@ else {
|
||||
map { $access_types{$_}++ } @access_types;
|
||||
$site_file = ($config{'webmin_apache'} || $module_config_directory)."/site";
|
||||
$httpd_info_cache = $module_config_directory."/httpd-info";
|
||||
$last_config_change_flag = $module_var_directory."/config-flag";
|
||||
$last_restart_time_flag = $module_var_directory."/restart-flag";
|
||||
|
||||
# Check if a list of supported modules needs to be built. This is done
|
||||
# if the Apache binary changes, when Webmin is upgraded, or once every five
|
||||
@@ -606,6 +608,7 @@ for($i=0; $i<@old || $i<@{$_[1]}; $i++) {
|
||||
$change = $old[$i];
|
||||
}
|
||||
}
|
||||
&update_last_config_change();
|
||||
return &unique(@files);
|
||||
}
|
||||
|
||||
@@ -686,6 +689,7 @@ elsif (!$olddir && $newdir) {
|
||||
$newdir->{'file'});
|
||||
}
|
||||
}
|
||||
&update_last_config_change();
|
||||
}
|
||||
|
||||
# recursive_set_lines_files(&directives, first-line, file)
|
||||
@@ -1586,6 +1590,7 @@ else {
|
||||
&kill_logged('HUP', $1) || return &text('restart_esig', $1);
|
||||
&wait_for_graceful();
|
||||
}
|
||||
&restart_last_restart_time();
|
||||
return undef;
|
||||
}
|
||||
|
||||
@@ -2040,5 +2045,21 @@ local $d = &virtual_server::get_domain_by("dom", $n);
|
||||
return $d;
|
||||
}
|
||||
|
||||
# update_last_config_change()
|
||||
# Updates the flag file indicating when the config was changed
|
||||
sub update_last_config_change
|
||||
{
|
||||
&open_tempfile(FLAG, ">$last_config_change_flag", 0, 1);
|
||||
&close_tempfile(FLAG);
|
||||
}
|
||||
|
||||
# restart_last_restart_time()
|
||||
# Updates the flag file indicating when the config was changed
|
||||
sub restart_last_restart_time
|
||||
{
|
||||
&open_tempfile(FLAG, ">$last_restart_time_flag", 0, 1);
|
||||
&close_tempfile(FLAG);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ else {
|
||||
}
|
||||
&flush_file_lines();
|
||||
&unlock_file($d->{'file'});
|
||||
&update_last_config_change();
|
||||
&after_changing();
|
||||
|
||||
&webmin_log("dir", $in{'delete'} ? 'delete' : 'save',
|
||||
|
||||
@@ -36,6 +36,7 @@ else {
|
||||
}
|
||||
&flush_file_lines();
|
||||
&unlock_file($d->{'file'});
|
||||
&update_last_config_change();
|
||||
&after_changing();
|
||||
|
||||
&webmin_log("files", $in{'delete'} ? 'delete' : 'save',
|
||||
|
||||
@@ -37,6 +37,7 @@ else {
|
||||
# Add to file
|
||||
&save_directive_struct(undef, $dir, $vconf, $conf);
|
||||
&flush_file_lines();
|
||||
&update_last_config_change();
|
||||
&unlock_file($vconf->[0]->{'file'});
|
||||
|
||||
&after_changing();
|
||||
|
||||
@@ -31,6 +31,7 @@ else {
|
||||
# Add to file
|
||||
&save_directive_struct(undef, $dir, $hconf, $hconf);
|
||||
&flush_file_lines();
|
||||
&update_last_config_change();
|
||||
&unlock_file($in{'file'});
|
||||
|
||||
&after_changing();
|
||||
|
||||
@@ -240,6 +240,7 @@ if ($in{'adddir'} && $in{'root'}) {
|
||||
&save_directive_struct(undef, $virt, $conf, $conf);
|
||||
&flush_file_lines();
|
||||
&unlock_file($f);
|
||||
&update_last_config_change();
|
||||
&unlock_apache_files();
|
||||
|
||||
# Create a symlink from another dir, if requested (as in Debian)
|
||||
|
||||
@@ -26,6 +26,7 @@ foreach $vconf (@virts) {
|
||||
}
|
||||
&flush_file_lines();
|
||||
&unlock_all_files();
|
||||
&update_last_config_change();
|
||||
&after_changing();
|
||||
&webmin_log("virts", "delete", scalar(@virts));
|
||||
&redirect("");
|
||||
|
||||
@@ -75,6 +75,7 @@ if ($config{'test_manual'}) {
|
||||
}
|
||||
unlink($temp);
|
||||
&unlock_file($file);
|
||||
&update_last_config_change();
|
||||
&webmin_log($logtype, "manual", $logname, \%in);
|
||||
|
||||
foreach $h ('virt', 'idx', 'file') {
|
||||
|
||||
@@ -18,6 +18,7 @@ if ($in{'delete'}) {
|
||||
&delete_file_if_empty($vconf->{'file'});
|
||||
&flush_file_lines();
|
||||
&unlock_file($vconf->{'file'});
|
||||
&update_last_config_change();
|
||||
|
||||
&after_changing();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user