diff --git a/postgresql/CHANGELOG b/postgresql/CHANGELOG index a0eb60092..354ee20cd 100644 --- a/postgresql/CHANGELOG +++ b/postgresql/CHANGELOG @@ -73,3 +73,4 @@ Added a history of previous commands to the Execute SQL page. Added greater than / less than selectors to the table data search form. ---- Changes since 1.530 ---- Added an option to the restore form to limit the restore to only certain tables. +When creating a new database, a template database to copy from can now be selected. diff --git a/postgresql/lang/en b/postgresql/lang/en index 9ea7bb877..f367c7117 100644 --- a/postgresql/lang/en +++ b/postgresql/lang/en @@ -218,6 +218,8 @@ newdb_epath=Missing database path newdb_user=Owned by user newdb_encoding=Character set encoding newdb_eencoding=Missing character set encoding +newdb_template=Template database +newdb_notemplate=None user_title=PostgreSQL Users user_ecannot=You are not allowed to edit users diff --git a/postgresql/newdb.cgi b/postgresql/newdb.cgi index 35b0395cf..63b23cdb3 100755 --- a/postgresql/newdb.cgi +++ b/postgresql/newdb.cgi @@ -27,6 +27,9 @@ if (!$in{'encoding_def'} && &get_postgresql_version() >= 8) { $in{'encoding'} =~ /\S/ || &error($text{'newdb_eencoding'}); $cmd .= " encoding = '$in{'encoding'}'"; } +if ($in{'template'}) { + $cmd .= " template = $in{'template'}"; + } &execute_sql_logged($config{'basedb'}, $cmd); &webmin_log("create", "db", $in{'db'}); if ($access{'dbs'} ne '*') { diff --git a/postgresql/newdb_form.cgi b/postgresql/newdb_form.cgi index 45dfa65fe..fe2088476 100755 --- a/postgresql/newdb_form.cgi +++ b/postgresql/newdb_form.cgi @@ -34,6 +34,12 @@ if (&get_postgresql_version() >= 8) { print &ui_table_row($text{'newdb_path'}, &ui_opt_textbox("path", undef, 40, $text{'default'})); +# Template DB +print &ui_table_row($text{'newdb_template'}, + &ui_select("template", undef, + [ [ undef, "<".$text{'newdb_notemplate'}.">" ], + &list_databases() ])); + print &ui_table_end(); print &ui_form_end([ [ undef, $text{'create'} ] ]);