rename to vmail-
This commit is contained in:
parent
3585a8c0ad
commit
dc36299dd1
|
@ -24,20 +24,17 @@ if (!is_writable("/var/vmail/$virtualhost")) {
|
||||||
|
|
||||||
$roundcubemail = array();
|
$roundcubemail = array();
|
||||||
|
|
||||||
if (!is_readable('/usr/local/etc/vmail-db-info.conf')) {
|
if (is_readable("/var/vmail/.my.cnf")) {
|
||||||
$user = posix_getpwuid(posix_geteuid());
|
$dbHost = trim(`grep -m 1 host /var/vmail/.my.cnf |cut -d = -f 2|cut -d ' ' -f 2`);
|
||||||
$username = $user['name'];
|
$dbDatabase = trim(`grep -m 1 database /var/vmail/.my.cnf |cut -d = -f 2|cut -d ' ' -f 2`);
|
||||||
echo "/var/vmail/$virtualhost is not writable by this user ($username).\n";
|
$dbUser = trim(`grep -m 1 user /var/vmail/.my.cnf |cut -d = -f 2|cut -d ' ' -f 2`);
|
||||||
echo "re-run this script as user vmail or root or another user that can read the /usr/local/etc/vmail-db-info.conf config file\n";
|
$dbPass = trim(`grep -m 1 password /var/vmail/.my.cnf |cut -d = -f 2|cut -d ' ' -f 2`);
|
||||||
|
$dbLink = mysqli_connect($dbHost, $dbUser, "$dbPass", $dbDatabase);
|
||||||
|
} else {
|
||||||
|
echo "vmail .my.cnf config file does not exist or is not readable by you\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dbHost = trim(`grep -m 1 host /usr/local/etc/vmail-db-info.conf |cut -d = -f 2|cut -d ' ' -f 2`);
|
|
||||||
$dbDatabase = trim(`grep -m 1 database /usr/local/etc/vmail-db-info.conf |cut -d = -f 2|cut -d ' ' -f 2`);
|
|
||||||
$dbUser = trim(`grep -m 1 user /usr/local/etc/vmail-db-info.conf |cut -d = -f 2|cut -d ' ' -f 2`);
|
|
||||||
$dbPass = trim(`grep -m 1 password /usr/local/etc/vmail-db-info.conf |cut -d = -f 2|cut -d ' ' -f 2`);
|
|
||||||
$dbLink = mysqli_connect($dbHost, $dbUser, "$dbPass", $dbDatabase);
|
|
||||||
|
|
||||||
$dbQuery = "SELECT * FROM rc_users WHERE username LIKE '%@$virtualhost'";
|
$dbQuery = "SELECT * FROM rc_users WHERE username LIKE '%@$virtualhost'";
|
||||||
$dbResult = mysqli_query($dbLink, $dbQuery);
|
$dbResult = mysqli_query($dbLink, $dbQuery);
|
||||||
while ($row_users = mysqli_fetch_assoc($dbResult)) {
|
while ($row_users = mysqli_fetch_assoc($dbResult)) {
|
|
@ -9,18 +9,23 @@ if ($virtualhost == "") {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_readable("/var/vmail/$virtualhost/roundcubemail")) {
|
if (is_readable("/var/vmail/$virtualhost/roundcubemail")) {
|
||||||
|
$roundcubemail = unserialize(file_get_contents("/var/vmail/$virtualhost/roundcubemail"));
|
||||||
|
} else {
|
||||||
echo "$virtualhost roundcubemail file does not exist or is not readable by you\n";
|
echo "$virtualhost roundcubemail file does not exist or is not readable by you\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$roundcubemail = unserialize(file_get_contents("/var/vmail/$virtualhost/roundcubemail"));
|
if (is_readable("/var/vmail/.my.cnf")) {
|
||||||
|
$dbHost = trim(`grep -m 1 host /var/vmail/.my.cnf |cut -d = -f 2|cut -d ' ' -f 2`);
|
||||||
$dbHost = trim(`grep -m 1 host /usr/local/etc/vmail-db-info.conf |cut -d = -f 2|cut -d ' ' -f 2`);
|
$dbDatabase = trim(`grep -m 1 database /var/vmail/.my.cnf |cut -d = -f 2|cut -d ' ' -f 2`);
|
||||||
$dbDatabase = trim(`grep -m 1 database /usr/local/etc/vmail-db-info.conf |cut -d = -f 2|cut -d ' ' -f 2`);
|
$dbUser = trim(`grep -m 1 user /var/vmail/.my.cnf |cut -d = -f 2|cut -d ' ' -f 2`);
|
||||||
$dbUser = trim(`grep -m 1 user /usr/local/etc/vmail-db-info.conf |cut -d = -f 2|cut -d ' ' -f 2`);
|
$dbPass = trim(`grep -m 1 password /var/vmail/.my.cnf |cut -d = -f 2|cut -d ' ' -f 2`);
|
||||||
$dbPass = trim(`grep -m 1 password /usr/local/etc/vmail-db-info.conf |cut -d = -f 2|cut -d ' ' -f 2`);
|
|
||||||
$dbLink = mysqli_connect($dbHost, $dbUser, "$dbPass", $dbDatabase);
|
$dbLink = mysqli_connect($dbHost, $dbUser, "$dbPass", $dbDatabase);
|
||||||
|
} else {
|
||||||
|
echo "vmail .my.cnf config file does not exist or is not readable by you\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$user_id_new = 0;
|
$user_id_new = 0;
|
||||||
$identity_id_new = 0;
|
$identity_id_new = 0;
|
|
@ -25,7 +25,7 @@ fi
|
||||||
|
|
||||||
# enable webmail vhost & restart apache
|
# enable webmail vhost & restart apache
|
||||||
if [ ! -f "/etc/apache2/sites-available/mail.$virtualhost.conf" ]; then
|
if [ ! -f "/etc/apache2/sites-available/mail.$virtualhost.conf" ]; then
|
||||||
echo "Use VHostMAIL $virtualhost" > /etc/apache2/sites-available/mail.$virtualhost.conf
|
echo "Use VMailHTTPS mail.$virtualhost" > /etc/apache2/sites-available/mail.$virtualhost.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -h "/etc/apache2/sites-enabled/mail.$virtualhost.conf" ]; then
|
if [ ! -h "/etc/apache2/sites-enabled/mail.$virtualhost.conf" ]; then
|
Loading…
Reference in New Issue
Block a user