Handle hostnames with upper-case letters
[webmin.git] / status / oldfile-monitor.pl
1 # oldfile-monitor.pl
2 # Check if some file has not been changed lately
3
4 sub get_oldfile_status
5 {
6 local %change;
7 local @st = stat($_[0]->{'file'});
8 if (!@st) {
9         # File doesn't exist!
10         return { 'up' => -1 };
11         }
12 elsif ($st[9] < time()-$_[0]->{'diff'}) {
13         # File hasn't been changed lately
14         return { 'up' => 0 };
15         }
16 else {
17         # File has been changed lately
18         return { 'up' => 1 };
19         }
20 }
21
22 sub show_oldfile_dialog
23 {
24 print &ui_table_row($text{'oldfile_file'},
25         &ui_textbox("file", $_[0]->{'file'}, 50)." ".
26         &file_chooser_button("file", 0), 3);
27
28 print &ui_table_row($text{'oldfile_diff'},
29         &ui_textbox("diff", $_[0]->{'diff'}, 10)." ".$text{'oldfile_secs'});
30 }
31
32 sub parse_oldfile_dialog
33 {
34 $_[0]->{'file'} = $in{'file'};
35 $_[0]->{'diff'} = $in{'diff'};
36 }
37