Add DirectAdmin support. Also tested on DirectAdmin v 1.40.3 on Debian 6 - 64 bits #17

This commit is contained in:
Michiel 2012-04-26 15:49:29 +03:00
parent 71f14ea053
commit 33d97c672c

View file

@ -292,6 +292,23 @@ sub mysql_setup {
badprint "Attempted to use login credentials from Plesk, but they failed.\n"; badprint "Attempted to use login credentials from Plesk, but they failed.\n";
exit 0; exit 0;
} }
} elsif ( -r "/usr/local/directadmin/conf/mysql.conf" and $doremote == 0 ){
# It's a DirectAdmin box, use the available credentials
my $mysqluser=`cat /usr/local/directadmin/conf/mysql.conf | egrep '^user=.*'`;
my $mysqlpass=`cat /usr/local/directadmin/conf/mysql.conf | egrep '^passwd=.*'`;
$mysqluser =~ s/user=//;
$mysqluser =~ s/[\r\n]//;
$mysqlpass =~ s/passwd=//;
$mysqlpass =~ s/[\r\n]//;
$mysqllogin = "-u $mysqluser -p$mysqlpass";
my $loginstatus = `mysqladmin ping $mysqllogin 2>&1`;
unless ($loginstatus =~ /mysqld is alive/) {
badprint "Attempted to use login credentials from DirectAdmin, but they failed.\n";
exit 0;
}
} elsif ( -r "/etc/mysql/debian.cnf" and $doremote == 0 ){ } elsif ( -r "/etc/mysql/debian.cnf" and $doremote == 0 ){
# We have a debian maintenance account, use it # We have a debian maintenance account, use it
$mysqllogin = "--defaults-file=/etc/mysql/debian.cnf"; $mysqllogin = "--defaults-file=/etc/mysql/debian.cnf";