Handle hostnames with upper-case letters
[webmin.git] / status / change-monitor.pl
1 # change-monitor.pl
2 # Check if some file or directory has changed
3
4 sub get_change_status
5 {
6 local %change;
7 &read_file("$module_config_directory/change", \%change);
8 local $t = $change{$_[0]->{'file'}};
9 local @st = stat($_[0]->{'file'});
10 local $rv;
11 if ($t && $st[9] != $t) {
12         $rv = { 'up' => 0 };
13         }
14 elsif (!$t) {
15         $rv = { 'up' => -1 };
16         }
17 else {
18         $rv = { 'up' => 1 };
19         }
20 $change{$_[0]->{'file'}} = $st[9];
21 &write_file("$module_config_directory/change", \%change);
22 return $rv;
23 }
24
25 sub show_change_dialog
26 {
27 print &ui_table_row($text{'change_file'},
28         &ui_textbox("file", $_[0]->{'file'}, 30)." ".
29         &file_chooser_button("file", 0), 3);
30 }
31
32 sub parse_change_dialog
33 {
34 $_[0]->{'file'} = $in{'file'};
35 }
36