mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Manual editing icon for MySQL config file https://github.com/webmin/webmin/issues/766
This commit is contained in:
32
mysql/edit_manual.cgi
Executable file
32
mysql/edit_manual.cgi
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Show a config file for manual editing
|
||||
|
||||
require './mysql-lib.pl';
|
||||
&ReadParse();
|
||||
&ui_print_header($header_subtext, $text{'manual_title'}, "");
|
||||
|
||||
$conf = &get_mysql_config();
|
||||
@files = &unique(map { $_->{'file'} } @$conf);
|
||||
$in{'manual'} ||= $files[0];
|
||||
&indexof($in{'manual'}, @files) >= 0 ||
|
||||
&error($text{'manual_efile'});
|
||||
|
||||
# File selector
|
||||
print &ui_form_start("edit_manual.cgi");
|
||||
print $form_hiddens;
|
||||
print "<b>$text{'manual_file'}</b>\n",
|
||||
&ui_select("manual", $in{'manual'}, \@files),"\n",
|
||||
&ui_submit('Edit');
|
||||
print &ui_form_end();
|
||||
|
||||
# Config editor
|
||||
print &ui_form_start("save_manual.cgi", "form-data");
|
||||
print $form_hiddens;
|
||||
print &ui_hidden("manual", $in{'manual'});
|
||||
print &ui_table_start(undef, undef, 2);
|
||||
print &ui_table_row(undef,
|
||||
&ui_textarea("data", &read_file_contents($in{'manual'}), 20, 80), 2);
|
||||
print &ui_table_end();
|
||||
print &ui_form_end([ [ undef, $text{'save'} ] ]);
|
||||
|
||||
&ui_print_footer("", $text{'index_return'});
|
||||
BIN
mysql/images/manual.gif
Normal file
BIN
mysql/images/manual.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 478 B |
@@ -220,22 +220,22 @@ else {
|
||||
@links = ( 'list_users.cgi', 'list_dbs.cgi',
|
||||
$canhosts ? ( 'list_hosts.cgi' ) : ( ),
|
||||
'list_tprivs.cgi', 'list_cprivs.cgi',
|
||||
'edit_cnf.cgi', 'list_procs.cgi',
|
||||
'edit_cnf.cgi', 'edit_manual.cgi', 'list_procs.cgi',
|
||||
$canvars ? ( 'list_vars.cgi' ) : ( ),
|
||||
'root_form.cgi',
|
||||
);
|
||||
@titles = ( $text{'users_title'}, $text{'dbs_title'},
|
||||
$canhosts ? ( $text{'hosts_title'} ) : ( ),
|
||||
$text{'tprivs_title'},
|
||||
$text{'cprivs_title'}, $text{'cnf_title'},
|
||||
$text{'tprivs_title'}, $text{'cprivs_title'},
|
||||
$text{'cnf_title'}, $text{'manual_title'},
|
||||
$text{'procs_title'},
|
||||
$canvars ? ( $text{'vars_title'} ) : ( ),
|
||||
$text{'root_title'},
|
||||
);
|
||||
@images = ( 'images/users.gif', 'images/dbs.gif',
|
||||
$canhosts ? ( 'images/hosts.gif' ) : ( ),
|
||||
'images/tprivs.gif',
|
||||
'images/cprivs.gif', 'images/cnf.gif',
|
||||
'images/tprivs.gif', 'images/cprivs.gif',
|
||||
'images/cnf.gif', 'images/manual.gif',
|
||||
'images/procs.gif',
|
||||
$canvars ? ( 'images/vars.gif' ) : ( ),
|
||||
'images/root.gif',
|
||||
|
||||
@@ -591,6 +591,7 @@ log_importupload=Imported data from uploaded file
|
||||
log_importfile=Imported data from file $1
|
||||
log_set=Changed $1 MySQL variables
|
||||
log_root=Changed administration password
|
||||
log_manual=Manually edited config file
|
||||
|
||||
backup_title=Backup Database
|
||||
backup_title2=Backup All Databases
|
||||
@@ -739,6 +740,12 @@ cnf_emax_connections=Missing or invalid maximum number of connections
|
||||
cnf_restart=Save and Restart MySQL
|
||||
cnf_fpt=Separate file for each InnoDB table?
|
||||
|
||||
manual_title=Edit Config Files
|
||||
manual_file=Edit config file:
|
||||
manual_ok=OK
|
||||
manual_efile=Invalid configuration file!
|
||||
manual_err=Failed to save configuration file
|
||||
|
||||
index_title1=Create Index
|
||||
index_header1=Index options
|
||||
index_name=Index name
|
||||
|
||||
@@ -92,6 +92,9 @@ elsif ($action eq 'set') {
|
||||
elsif ($action eq 'root') {
|
||||
return $text{'log_root'};
|
||||
}
|
||||
elsif ($action eq 'manual') {
|
||||
return $text{'log_manual'};
|
||||
}
|
||||
else {
|
||||
return undef;
|
||||
}
|
||||
|
||||
22
mysql/save_manual.cgi
Executable file
22
mysql/save_manual.cgi
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Save a manually edited config file
|
||||
|
||||
require './mysql-lib.pl';
|
||||
&ReadParseMime();
|
||||
&error_setup($text{'manual_err'});
|
||||
|
||||
# Validate the filename
|
||||
$conf = &get_mysql_config();
|
||||
@files = &unique(map { $_->{'file'} } @$conf);
|
||||
$in{'manual'} ||= $files[0];
|
||||
&indexof($in{'manual'}, @files) >= 0 ||
|
||||
&error($text{'manual_efile'});
|
||||
|
||||
# Write the file
|
||||
$in{'data'} =~ s/\r//g;
|
||||
&open_lock_tempfile(MANUAL, ">$in{'manual'}");
|
||||
&print_tempfile(MANUAL, $in{'data'});
|
||||
&close_tempfile(MANUAL);
|
||||
|
||||
&webmin_log("manual");
|
||||
&redirect("");
|
||||
Reference in New Issue
Block a user