diff --git a/bin/roundcubemail-settings-export.php b/bin/roundcubemail-settings-export.php index 52a921a..b7cc224 100755 --- a/bin/roundcubemail-settings-export.php +++ b/bin/roundcubemail-settings-export.php @@ -24,6 +24,14 @@ if (!is_writable("/var/vmail/$virtualhost")) { $roundcubemail = array(); +if (!is_readable('/usr/local/etc/vmail-db-info.conf')) { + $user = posix_getpwuid(posix_geteuid()); + $username = $user['name']; + echo "/var/vmail/$virtualhost is not writable by this user ($username).\n"; + 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"; + 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`); diff --git a/bin/roundcubemail-settings-import.php b/bin/roundcubemail-settings-import.php index d949043..77ecdf0 100755 --- a/bin/roundcubemail-settings-import.php +++ b/bin/roundcubemail-settings-import.php @@ -9,8 +9,8 @@ if ($virtualhost == "") { exit; } -if (!is_file("/var/vmail/$virtualhost/roundcubemail")) { - echo "$virtualhost roundcubemail file does not exist\n"; +if (!is_readable("/var/vmail/$virtualhost/roundcubemail")) { + echo "$virtualhost roundcubemail file does not exist or is not readable by you\n"; exit; }