-
-
Notifications
You must be signed in to change notification settings - Fork 117
/
Copy pathsave_mysqlremote.cgi
executable file
·33 lines (27 loc) · 1.15 KB
/
save_mysqlremote.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/local/bin/perl
# Update the remote MySQL server used by this domain
require './virtual-server-lib.pl';
&ReadParse();
&licence_status();
$d = &get_domain($in{'dom'});
&can_edit_domain($d) || &error($text{'edit_ecannot'});
&can_edit_databases($d) || &error($text{'databases_ecannot'});
&can_edit_templates() || &error($text{'databases_ecannot'});
# Get the new module
my @mymods = &list_remote_mysql_modules();
my ($mymod) = grep { ($d->{'mysql_module'} || 'mysql') eq
$_->{'minfo'}->{'dir'} } @mymods;
my ($newmod) = grep { $in{'mymod'} eq $_->{'minfo'}->{'dir'} } @mymods;
if ($mymod->{'minfo'}->{'dir'} eq $newmod->{'minfo'}->{'dir'}) {
# Nothing to do, bail out
&redirect("list_databases.cgi?dom=$in{'dom'}&databasemode=remote");
return;
}
# Do the move
&ui_print_unbuffered_header(&domain_in($d), $text{'databases_title'}, "");
print "<b>",&text('databases_moving',
$mymod->{'desc'}, $newmod->{'desc'}),"</b><p>\n";
&move_mysql_server($d, $newmod->{'minfo'}->{'dir'},
$newmod->{'config'}->{'host'});
&webmin_log("mysqlremote", "domain", $d->{'dom'}, $d);
&ui_print_footer("list_databases.cgi?dom=$in{'dom'}", $text{'databases_return'});