mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 16:50:24 +00:00
Collation order field
This commit is contained in:
@@ -88,3 +88,5 @@ MySQL stored procedures are now included in backups, where supported.
|
||||
Restores and imports from local files are now run as the Unix user configured for backups, rather than root.
|
||||
---- Changes since 1.490 ----
|
||||
The information_schema database is no longer included when backing up all databases, as it really just contains metadata.
|
||||
---- Changes since 1.500 ----
|
||||
Added a collation order field to the database creation form.
|
||||
|
||||
@@ -428,6 +428,7 @@ newdb_table=Initial table
|
||||
newdb_none=None
|
||||
newdb_tname=Named
|
||||
newdb_charset=Character set
|
||||
newdb_collation=Collation order
|
||||
newdb_str=with fields below
|
||||
newdb_err=Failed to create database
|
||||
newdb_edb=Missing or invalid database name
|
||||
|
||||
@@ -1234,6 +1234,20 @@ else {
|
||||
return sort { lc($a) cmp lc($b) } @rv;
|
||||
}
|
||||
|
||||
# list_collation_orders([db])
|
||||
# Returns a list of supported collation orders. Each row is an array ref of
|
||||
# a code and character set it can work with.
|
||||
sub list_collation_orders
|
||||
{
|
||||
local @rv;
|
||||
local $db = $_[0] || $master_db;
|
||||
if ($mysql_version >= 5) {
|
||||
local $d = &execute_sql($db, "show collation");
|
||||
@rv = map { [ $_->[0], $_->[1] ] } @{$d->{'data'}};
|
||||
}
|
||||
return sort { lc($a) cmp lc($b) } @rv;
|
||||
}
|
||||
|
||||
# list_system_variables()
|
||||
# Returns a list of all system variables, and their default values
|
||||
sub list_system_variables
|
||||
|
||||
@@ -19,7 +19,8 @@ if (!$in{'table_def'}) {
|
||||
@sql = &parse_table_form([ ], $in{'table'});
|
||||
}
|
||||
&execute_sql_logged($master_db, "create database "."estr($in{'db'}).
|
||||
($in{'charset'} ? " character set $in{'charset'}" : ""));
|
||||
($in{'charset'} ? " character set $in{'charset'}" : "").
|
||||
($in{'collation'} ? " collate $in{'collation'}" : ""));
|
||||
&webmin_log("create", "db", $in{'db'});
|
||||
if (@sql) {
|
||||
foreach $sql (@sql) {
|
||||
|
||||
@@ -15,10 +15,22 @@ print &ui_table_row($text{'newdb_db'},
|
||||
|
||||
if ($mysql_version >= 4.1) {
|
||||
# Character set option
|
||||
@charsets = &list_character_sets();
|
||||
%csmap = map { $_->[0], $_->[1] } @charsets;
|
||||
print &ui_table_row($text{'newdb_charset'},
|
||||
&ui_select("charset", undef,
|
||||
[ [ undef, "<$text{'default'}>" ],
|
||||
&list_character_sets() ]));
|
||||
@charsets ]));
|
||||
}
|
||||
|
||||
@coll = &list_collation_orders();
|
||||
if (@coll) {
|
||||
# Collation order option
|
||||
print &ui_table_row($text{'newdb_collation'},
|
||||
&ui_select("collation", undef,
|
||||
[ [ undef, "<$text{'default'}>" ],
|
||||
map { [ $_->[0], $_->[0]." (".$csmap{$_->[1]}.")" ] }
|
||||
&list_collation_orders() ]));
|
||||
}
|
||||
|
||||
# Initial table name
|
||||
|
||||
Reference in New Issue
Block a user