Handle hostnames with upper-case letters
[webmin.git] / phpini / edit_db.cgi
1 #!/usr/local/bin/perl
2 # Show options related to MySQL and other database connections
3
4 require './phpini-lib.pl';
5 &ReadParse();
6 &can_php_config($in{'file'}) || &error($text{'list_ecannot'});
7 $conf = &get_config($in{'file'});
8
9 &ui_print_header("<tt>$in{'file'}</tt>", $text{'db_title'}, "");
10 @tds = ( "width=30%" );
11
12 print &ui_form_start("save_db.cgi", "post");
13 print &ui_hidden("file", $in{'file'}),"\n";
14
15 # First section is for MySQL options
16 print &ui_table_start($text{'db_header1'}, "width=100%", 2);
17
18 # Allow persistent MySQL connections
19 print &ui_table_row($text{'db_persist'},
20             &onoff_radio("mysql.allow_persistent"),
21             undef, \@tds);
22
23 # Max persistent connections
24 $mp = &find_value("mysql.max_persistent", $conf);
25 print &ui_table_row($text{'db_maxpersist'},
26             &ui_opt_textbox("mysql.max_persistent", $mp <= 0 ? undef : $mp,
27                             5, $text{'db_unlimited'}),
28             undef, \@tds);
29
30 # Max total connections
31 $mp = &find_value("mysql.max_links", $conf);
32 print &ui_table_row($text{'db_maxlinks'},
33             &ui_opt_textbox("mysql.max_links", $mp <= 0 ? undef : $mp,
34                             5, $text{'db_unlimited'}),
35             undef, \@tds);
36
37 # Connection timeout
38 $ct = &find_value("mysql.connect_timeout", $conf);
39 print &ui_table_row($text{'db_timeout'},
40             &ui_opt_textbox("mysql.connect_timeout", $ct <= 0 ? undef : $ct,
41                             5,$text{'default'})." ".$text{'db_s'},
42             undef, \@tds);
43
44 # Default host
45 print &ui_table_row($text{'db_host'},
46             &ui_opt_textbox("mysql.default_host",
47                             &find_value("mysql.default_host", $conf),
48                             30, "<tt>localhost</tt>"),
49             undef, \@tds);
50
51 # Default port
52 print &ui_table_row($text{'db_port'},
53             &ui_opt_textbox("mysql.default_port",
54                             &find_value("mysql.default_port", $conf),
55                             5, "<tt>3306</tt>"),
56             undef, \@tds);
57
58 print &ui_table_end();
59
60
61 # Second section is for PostgreSQL options
62 print &ui_table_start($text{'db_header2'}, "width=100%", 2);
63
64 # Allow persistent PostgreSQL connections
65 print &ui_table_row($text{'db_persist'},
66             &onoff_radio("pgsql.allow_persistent"),
67             undef, \@tds);
68
69 # Re-open persistent PostgreSQL connections
70 print &ui_table_row($text{'db_reset'},
71             &onoff_radio("pgsql.auto_reset_persistent"),
72             undef, \@tds);
73
74 # Max persistent connections
75 $mp = &find_value("pgsql.max_persistent", $conf);
76 print &ui_table_row($text{'db_maxpersist'},
77             &ui_opt_textbox("pgsql.max_persistent", $mp <= 0 ? undef : $mp,
78                             5, $text{'db_unlimited'}),
79             undef, \@tds);
80
81 # Max total connections
82 $mp = &find_value("pgsql.max_links", $conf);
83 print &ui_table_row($text{'db_maxlinks'},
84             &ui_opt_textbox("pgsql.max_links", $mp <= 0 ? undef : $mp,
85                             5, $text{'db_unlimited'}),
86             undef, \@tds);
87
88
89 print &ui_table_end();
90
91 print &ui_form_end([ [ "save", $text{'save'} ] ]);
92
93 &ui_print_footer("list_ini.cgi?file=".&urlize($in{'file'}),
94                  $text{'list_return'});