Add field for editing default MySQL table type
authorJamie Cameron <jcameron@webmin.com>
Mon, 1 Mar 2010 22:02:27 +0000 (14:02 -0800)
committerJamie Cameron <jcameron@webmin.com>
Mon, 1 Mar 2010 22:02:27 +0000 (14:02 -0800)
mysql/CHANGELOG
mysql/edit_cnf.cgi
mysql/lang/en
mysql/mysql-lib.pl
mysql/save_cnf.cgi

index 73ffcb0..e5ec3ad 100644 (file)
@@ -91,3 +91,4 @@ The information_schema database is no longer included when backing up all databa
 ---- Changes since 1.500 ----
 Added a collation order field to the database creation form.
 Added an option to the backup form to do backup in a single transaction, for InnoDB tables.
+The default MySQL table type can now be set on the MySQL Server Configuration page.
index 8043c92..69564fd 100755 (executable)
@@ -45,6 +45,14 @@ print &ui_table_row($text{'cnf_datadir'},
                    &ui_opt_textbox("datadir", $datadir, 50, $text{'default'}).
                    " ".&file_chooser_button("datadir"), 3);
 
+$stor = &find_value("default-storage-engine", $mems);
+print &ui_table_row($text{'cnf_stor'},
+                   &ui_select("stor", $stor,
+                              [ [ '', $text{'default'} ],
+                                'MyISAM', 'InnoDB', 'MERGE',
+                                'NDB', 'ARCHIVE', 'CSV',
+                                'BLACKHOLE' ], 1, 0, 1));
+
 # Show set variables
 print &ui_table_hr();
 
@@ -63,7 +71,8 @@ foreach $v (@mysql_number_variables) {
        }
 
 print &ui_table_end();
-print &ui_form_end([ [ "save", $text{'save'} ] ]);
+print &ui_form_end([ [ "save", $text{'save'} ],
+                    [ "restart", $text{'cnf_restart'} ] ]);
 
 &ui_print_footer("", $text{'index_return'});
 
index 9db5356..30d662c 100644 (file)
@@ -723,6 +723,7 @@ cnf_bind=MySQL server listening address
 cnf_all=Any
 cnf_socket=MySQL Unix socket
 cnf_datadir=Databases files directory
+cnf_stor=Default table storage engine
 cnf_big-tables=Allow big tables?
 cnf_skip-locking=Skip locking of table files?
 cnf_emysqld=Could not find [mysqld] section in my.cnf
@@ -745,6 +746,7 @@ cnf_esort_buffer=Missing or invalid sort buffer size
 cnf_enet_buffer_length=Missing or invalid network buffer size
 cnf_emyisam_sort_buffer_size=Missing or invalid MyISAM sort buffer size
 cnf_emax_connections=Missing or invalid maximum number of connections
+cnf_restart=Save and Restart MySQL
 
 index_title1=Create Index
 index_header1=Index options
index 2686210..171ef2f 100755 (executable)
@@ -1070,7 +1070,7 @@ for(my $i=0; $i<@old || $i<@$values; $i++) {
        elsif (!$old && defined($values->[$i])) {
                # Adding
                splice(@$lref, $sect->{'eline'}+1, 0, $line);
-               &renumber($conf, $sect->{'eline'}, 1);
+               &renumber($conf, $sect->{'eline'}+1, 1);
                push(@{$sect->{'members'}},
                        { 'name' => $name,
                          'value' => $values->[$i],
index 8c8fd28..abb51b5 100755 (executable)
@@ -48,6 +48,9 @@ else {
        &save_directive($conf, $mysqld, "datadir", [ $in{'datadir'} ]);
        }
 
+&save_directive($conf, $mysqld, "default-storage-engine",
+               $in{'stor'} ? [ $in{'stor'} ] : [ ]);
+
 &save_directive($conf, $mysqld, "skip-locking",
                $in{'skip-locking'} ? [ "" ] : [ ]);
 
@@ -72,8 +75,13 @@ foreach $v (keys %vars) {
 &save_directive($conf, $mysqld, "set-variable", \@sets);
 
 # Write out file
-&flush_file_lines();
+&flush_file_lines($config{'my_cnf'});
 &unlock_file($config{'my_cnf'});
+if ($in{'restart'} && &is_mysql_running() > 0) {
+       &stop_mysql();
+       $err = &start_mysql();
+       &error($err) if ($err);
+       }
 &webmin_log("cnf");
 &redirect("");