Allow use of webmin variables in backup dests

This commit is contained in:
Jamie Cameron
2012-01-06 14:33:27 -08:00
parent e82828b105
commit 5fd32f9c11
66 changed files with 95 additions and 12 deletions
+1
View File
@@ -155,3 +155,4 @@ Even more German translation updates, thanks to Raymond Vetter.
Added UTF-8 encodings for languages using the iso-8859-2, like Czech and Polish.
Catalan updates, thanks to Jaume Badiella.
Norwegian translation updates, thanks to Stein-Aksel Basma.
The MySQL, PostgreSQL, Filesystem Backup and Backup Configuration Files modules now all support the use of Webmin variable substitutions in backup paths (like $HOSTNAME) via a new Module Config option.
+8 -2
View File
@@ -696,15 +696,21 @@ replaces them with the correct values for the current date and time.
=cut
sub date_subs
{
my ($path) = @_;
my $rv;
if ($config{'date_subs'}) {
eval "use POSIX";
eval "use posix" if ($@);
my @tm = localtime(time());
return strftime($_[0], @tm);
$rv = strftime($path, @tm);
}
else {
return $_[0];
$rv = $path;
}
if ($config{'webmin_subs'}) {
$rv = &substitute_template($rv, { });
}
return $rv;
}
=head2 show_backup_what(name, webmin?, nofiles?, others)
+1
View File
@@ -1,2 +1,3 @@
date_subs=0
webmin_subs=0
apply=1
+1
View File
@@ -1,2 +1,3 @@
date_subs=Do <tt>strftime</tt> substitution of backup destinations?,1,1-Yes,0-No
webmin_subs=Do Webmin variable substitution on backup destinations?,1,1-Yes,0-No
from_addr=From: address for email messages,3,webmin@hostname
+1
View File
@@ -1,4 +1,5 @@
date_subs=0
webmin_subs=0
run_mode=0
always_tar=0
nonewtape=0
+1
View File
@@ -1,4 +1,5 @@
date_subs=Do <tt>strftime</tt> substitution of backup destinations?,1,1-Yes,0-No
webmin_subs=Do Webmin variable substitution on backup destinations?,1,1-Yes,0-No
smtp_server=Send mail via SMTP server,3,Read User Mail module
run_mode=Run backups in,1,0-Foreground,1-Background
nonewtape=Prompt for new tape if full?,1,1-Yes,0-No
+9 -4
View File
@@ -102,18 +102,23 @@ return lc($fs1) eq lc($fs2);
# date_subs(string, [time])
sub date_subs
{
local ($path, $time) = @_;
local $rv;
if ($config{'date_subs'}) {
eval "use POSIX";
eval "use posix" if ($@);
local @tm = localtime($_[1] || time());
local @tm = localtime($time || time());
&clear_time_locale();
local $rv = strftime($_[0], @tm);
$rv = strftime($path, @tm);
&reset_time_locale();
return $rv;
}
else {
return $_[0];
$rv = $_[0];
}
if ($config{'webmin_subs'}) {
$rv = &substitute_template($rv, { });
}
return $rv;
}
# execute_before(&dump, handle, escape)
+1
View File
@@ -20,3 +20,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -18,3 +18,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/mysql/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/mysql/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -18,3 +18,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -16,3 +16,4 @@ max_dbs=50
my_cnf=/etc/mysql/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -23,3 +23,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -20,3 +20,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -20,3 +20,4 @@ max_dbs=50
my_cnf=/etc/mysql/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -20,3 +20,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
my_cnf=/etc/my.cnf
max_text=1000
nopwd=0
webmin_subs=0
+1
View File
@@ -8,6 +8,7 @@ blob_mode=Show blob and text fields as,1,0-Data in table,1-Links to download
nodbi=Use DBI to connect if available?,1,0-Yes,1-No
nopwd=Use MYSQL_PWD variable to pass password?,1,0-Yes,1-No
date_subs=Do <tt>strftime</tt> substitution of backup destinations?,1,1-Yes,0-No
webmin_subs=Do Webmin variable substitution on backup destinations?,1,1-Yes,0-No
passwd_mode=Password hashing mode,1,1-Old,0-Default
encoding=Encoding for database content,3,Default (from current language)
max_dbs=Maximum number of databases and tables to display,0,5
+8 -3
View File
@@ -783,18 +783,23 @@ else {
# Does strftime-style date substitutions on a filename, if enabled
sub date_subs
{
local ($path) = @_;
local $rv;
if ($config{'date_subs'}) {
eval "use POSIX";
eval "use posix" if ($@);
local @tm = localtime(time());
&clear_time_locale();
local $rv = strftime($_[0], @tm);
$rv = strftime($path, @tm);
&reset_time_locale();
return $rv;
}
else {
return $_[0];
$path = $rv;
}
if ($config{'webmin_subs'}) {
$rv = &substitute_template($rv, { });
}
return $rv;
}
# execute_before(db, handle, escape, path, db-for-config)
+1
View File
@@ -21,3 +21,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -21,3 +21,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -22,3 +22,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -21,3 +21,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -21,3 +21,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -23,3 +23,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -20,3 +20,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -20,3 +20,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -21,3 +21,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -20,3 +20,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -21,3 +21,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -20,3 +20,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -22,3 +22,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -22,3 +22,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -21,3 +21,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -22,3 +22,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -22,3 +22,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -19,3 +19,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -21,3 +21,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -22,3 +22,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -22,3 +22,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -22,3 +22,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -22,3 +22,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -22,3 +22,4 @@ max_dbs=50
simple_sched=0
access_own=0
max_text=1000
webmin_subs=0
+1
View File
@@ -25,3 +25,4 @@ encoding=
repository=
port=
host=
webmin_subs=0
+1
View File
@@ -8,6 +8,7 @@ add_mode=Use vertical row editing interface,1,1-Yes,0-No
blob_mode=Show blob and text fields as,1,0-Data in table,1-Links to download
nodbi=Use DBI to connect if available?,1,0-Yes,1-No
date_subs=Do <tt>strftime</tt> substitution of backup destinations?,1,1-Yes,0-No
webmin_subs=Do Webmin variable substitution on backup destinations?,1,1-Yes,0-No
simple_sched=Schedule selector format,1,1-Simple,0-Complex
encoding=Encoding for database content,3,Default (from current language)
max_dbs=Maximum number of databases and tables to display,0,5
+8 -3
View File
@@ -708,18 +708,23 @@ foreach my $pidfile (glob($config{'pid_file'})) {
# Does strftime-style date substitutions on a filename, if enabled
sub date_subs
{
local ($path) = @_;
local $rv;
if ($config{'date_subs'}) {
eval "use POSIX";
eval "use posix" if ($@);
local @tm = localtime(time());
&clear_time_locale();
local $rv = strftime($_[0], @tm);
$rv = strftime($path, @tm);
&reset_time_locale();
return $rv;
}
else {
return $_[0];
$rv = $path;
}
if ($config{'webmin_subs'}) {
$rv = &substitute_template($rv, { });
}
return $rv;
}
# execute_before(db, handle, escape, path, db-for-config)