Handle hostnames with upper-case letters
[webmin.git] / phpini / save_limits.cgi
1 #!/usr/local/bin/perl
2 # Update options related to memory limits
3
4 require './phpini-lib.pl';
5 &error_setup($text{'limits_err'});
6 &ReadParse();
7 &can_php_config($in{'file'}) || &error($text{'list_ecannot'});
8
9 &lock_file($in{'file'});
10 $conf = &get_config($in{'file'});
11
12 # Save memory limit
13 $in{"memory_limit_def"} || $in{"memory_limit"} =~ /^(\d+)(k|M|G|b|)$/ ||
14         &error($text{'limits_emem'});
15 &save_directive($conf, "memory_limit",
16                 $in{"memory_limit_def"} ? undef : $in{"memory_limit"});
17
18 # Save POST limit
19 $in{"post_max_size_def"} || $in{"post_max_size"} =~ /^(\d+)(k|M|G|b|)$/ ||
20         &error($text{'limits_epost'});
21 &save_directive($conf, "post_max_size",
22                 $in{"post_max_size_def"} ? undef : $in{"post_max_size"});
23
24 # Save upload limit
25 $in{"upload_max_filesize_def"} ||
26     $in{"upload_max_filesize"} =~ /^(\d+)(k|M|G|b|)$/ ||
27         &error($text{'limits_eupload'});
28 &save_directive($conf, "upload_max_filesize",
29                 $in{"upload_max_filesize_def"} ? undef
30                                                : $in{"upload_max_filesize"});
31
32 # Save max run time
33 $in{"max_execution_time_def"} || $in{"max_execution_time"} =~ /^\d+$/ ||
34         &error($text{'limits_emem'});
35 &save_directive($conf, "max_execution_time",
36         $in{"max_execution_time_def"} ? undef : $in{"max_execution_time"});
37
38 # Save max parsing time
39 $in{"max_input_time_def"} || $in{"max_input_time"} =~ /^\d+$/ ||
40         &error($text{'limits_einput'});
41 &save_directive($conf, "max_input_time",
42         $in{"max_input_time_def"} ? undef : $in{"max_input_time"});
43
44 &flush_file_lines_as_user($in{'file'});
45 &unlock_file($in{'file'});
46 &graceful_apache_restart();
47 &webmin_log("limits", undef, $in{'file'});
48
49 &redirect("list_ini.cgi?file=".&urlize($in{'file'}));
50