Michel Käser
2015-05-16 82e9b9e7c7ecf1664a7b0d4e57a5c4893739559d
define MySQL port by its own (rather than in the host with :port); it's simply cleaner
19 files modified
74 ■■■■ changed files
install/dist/lib/debian60.lib.php 1 ●●●● patch | view | raw | blame | history
install/dist/lib/fedora.lib.php 7 ●●●●● patch | view | raw | blame | history
install/dist/lib/gentoo.lib.php 1 ●●●● patch | view | raw | blame | history
install/dist/lib/opensuse.lib.php 7 ●●●●● patch | view | raw | blame | history
install/install.php 8 ●●●● patch | view | raw | blame | history
install/lib/installer_base.lib.php 9 ●●●●● patch | view | raw | blame | history
install/tpl/authmysqlrc.master 1 ●●●● patch | view | raw | blame | history
install/tpl/config.inc.php.master 3 ●●●●● patch | view | raw | blame | history
install/tpl/debian6_dovecot-sql.conf.master 2 ●●● patch | view | raw | blame | history
install/tpl/debian_dovecot-sql.conf.master 2 ●●● patch | view | raw | blame | history
install/tpl/fedora_dovecot-sql.conf.master 2 ●●● patch | view | raw | blame | history
install/tpl/mydns.conf.master 1 ●●●● patch | view | raw | blame | history
install/tpl/opensuse_dovecot-sql.conf.master 2 ●●● patch | view | raw | blame | history
install/tpl/pdns.local.master 1 ●●●● patch | view | raw | blame | history
install/update.php 4 ●●● patch | view | raw | blame | history
interface/lib/classes/db_mysql.inc.php 8 ●●●●● patch | view | raw | blame | history
interface/lib/config.inc.php 3 ●●●●● patch | view | raw | blame | history
server/lib/app.inc.php 2 ●●● patch | view | raw | blame | history
server/lib/classes/db_mysql.inc.php 10 ●●●●● patch | view | raw | blame | history
install/dist/lib/debian60.lib.php
@@ -127,6 +127,7 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        $content = str_replace('{server_id}', $conf['server_id'], $content);
        wf($config_dir.'/'.$configfile, $content);
install/dist/lib/fedora.lib.php
@@ -378,6 +378,7 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        wf("$config_dir/$configfile", $content);
        exec("chmod 660 $config_dir/$configfile");
@@ -496,6 +497,7 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        $content = str_replace('{server_id}', $conf['server_id'], $content);
        wf("$config_dir/$configfile", $content);
@@ -653,6 +655,7 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf["mysql"]["host"], $content);
        $content = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $content);
        $content = str_replace('{server_id}', $conf["server_id"], $content);
        wf($conf["mydns"]["config_dir"].'/'.$configfile, $content);
        exec('chmod 600 '.$conf["mydns"]["config_dir"].'/'.$configfile);
@@ -932,11 +935,13 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
        $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
        $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
        $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
        $content = str_replace('{mysql_master_server_port}', $conf['mysql']['master_port'], $content);
        $content = str_replace('{server_id}', $conf['server_id'], $content);
        $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
@@ -957,11 +962,13 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
        $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
        $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
        $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
        $content = str_replace('{mysql_master_server_port}', $conf['mysql']['master_port'], $content);
        $content = str_replace('{server_id}', $conf['server_id'], $content);
        $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
install/dist/lib/gentoo.lib.php
@@ -834,6 +834,7 @@
        $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
        $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
        $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
        $content = str_replace('{mysql_master_server_port}', $conf['mysql']['master_port'], $content);
        $content = str_replace('{server_id}', $conf['server_id'], $content);
        $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
install/dist/lib/opensuse.lib.php
@@ -433,6 +433,7 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        wf("$config_dir/$configfile", $content);
        exec("chmod 660 $config_dir/$configfile");
@@ -545,6 +546,7 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        $content = str_replace('{server_id}', $conf['server_id'], $content);
        wf("$config_dir/$configfile", $content);
@@ -700,6 +702,7 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf["mysql"]["host"], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        $content = str_replace('{server_id}', $conf["server_id"], $content);
        wf($conf["mydns"]["config_dir"].'/'.$configfile, $content);
        exec('chmod 600 '.$conf["mydns"]["config_dir"].'/'.$configfile);
@@ -1006,11 +1009,13 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
        $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
        $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
        $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
        $content = str_replace('{mysql_master_server_port}', $conf['mysql']['master_port'], $content);
        $content = str_replace('{server_id}', $conf['server_id'], $content);
        $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
@@ -1031,11 +1036,13 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
        $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
        $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
        $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
        $content = str_replace('{mysql_master_server_port}', $conf['mysql']['master_port'], $content);
        $content = str_replace('{server_id}', $conf['server_id'], $content);
        $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
install/install.php
@@ -189,6 +189,7 @@
$finished = false;
do {
    $tmp_mysql_server_host = $inst->free_query('MySQL server hostname', $conf['mysql']['host'],'mysql_hostname');     
    $tmp_mysql_server_port = $inst->free_query('MySQL server port', $conf['mysql']['port'],'mysql_port');
    $tmp_mysql_server_admin_user = $inst->free_query('MySQL root username', $conf['mysql']['admin_user'],'mysql_root_user');     
    $tmp_mysql_server_admin_password = $inst->free_query('MySQL root password', $conf['mysql']['admin_password'],'mysql_root_password');     
    $tmp_mysql_server_database = $inst->free_query('MySQL database to create', $conf['mysql']['database'],'mysql_database');     
@@ -202,8 +203,9 @@
    }
    //* Initialize the MySQL server connection
    if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
    if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, (int)$tmp_mysql_server_port)) {
        $conf['mysql']['host'] = $tmp_mysql_server_host;
        $conf['mysql']['port'] = $tmp_mysql_server_port;
        $conf['mysql']['admin_user'] = $tmp_mysql_server_admin_user;
        $conf['mysql']['admin_password'] = $tmp_mysql_server_admin_password;
        $conf['mysql']['database'] = $tmp_mysql_server_database;
@@ -535,13 +537,15 @@
        $finished = false;
        do {
            $tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host'],'mysql_master_hostname'); 
            $tmp_mysql_server_port = $inst->free_query('MySQL master server port', $conf['mysql']['master_port'],'mysql_master_port');
            $tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user'],'mysql_master_root_user');     
            $tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password'],'mysql_master_root_password'); 
            $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database');
            //* Initialize the MySQL server connection
            if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
            if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, (int)$tmp_mysql_server_port)) {
                $conf['mysql']['master_host'] = $tmp_mysql_server_host;
                $conf['mysql']['master_port'] = $tmp_mysql_server_port;
                $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user;
                $conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password;
                $conf['mysql']['master_database'] = $tmp_mysql_server_database;
install/lib/installer_base.lib.php
@@ -968,6 +968,7 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        wf($config_dir.'/'.$configfile, $content);
        chmod($config_dir.'/'.$configfile, 0660);
@@ -1081,6 +1082,7 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        $content = str_replace('{server_id}', $conf['server_id'], $content);
        wf($config_dir.'/'.$configfile, $content);
@@ -1259,6 +1261,7 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        $content = str_replace('{server_id}', $conf['server_id'], $content);
        wf($conf['mydns']['config_dir'].'/'.$configfile, $content);
        chmod($conf['mydns']['config_dir'].'/'.$configfile, 0600);
@@ -1302,6 +1305,7 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{powerdns_database}', $conf['powerdns']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        wf($conf['powerdns']['config_dir'].'/'.$configfile, $content);
        chmod($conf['powerdns']['config_dir'].'/'.$configfile, 0600);
        chown($conf['powerdns']['config_dir'].'/'.$configfile, 'root');
@@ -1967,11 +1971,13 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
        $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
        $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
        $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
        $content = str_replace('{mysql_master_server_port}', $conf['mysql']['master_port'], $content);
        $content = str_replace('{server_id}', $conf['server_id'], $content);
        $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
@@ -1992,11 +1998,13 @@
        $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
        $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
        $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
        $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
        $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
        $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
        $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
        $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
        $content = str_replace('{mysql_master_server_port}', $conf['mysql']['master_port'], $content);
        $content = str_replace('{server_id}', $conf['server_id'], $content);
        $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
@@ -2650,6 +2658,7 @@
        $tContents = str_replace('{mysql_server_database}', $conf["mysql"]["database"], $tContents);
        $tContents = str_replace('{mysql_server_ip}', $conf["mysql"]["ip"], $tContents);
        $tContents = str_replace('{mysql_server_host}', $conf['mysql']['host'], $tContents);
        $tContents = str_replace('{mysql_server_port}', $conf['mysql']['port'], $tContents);
        $tContents = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $tContents);
        return $tContents;
install/tpl/authmysqlrc.master
@@ -1,4 +1,5 @@
MYSQL_SERVER {mysql_server_host}
MYSQL_PORT {mysql_server_port}
MYSQL_USERNAME {mysql_server_ispconfig_user}
MYSQL_PASSWORD {mysql_server_ispconfig_password}
MYSQL_PORT 0
install/tpl/config.inc.php.master
@@ -63,6 +63,7 @@
//** Database
$conf['db_type'] = 'mysql';
$conf['db_host'] = '{mysql_server_host}';
$conf['db_port'] = '{mysql_server_port}';
$conf['db_database'] = '{mysql_server_database}';
$conf['db_user'] = '{mysql_server_ispconfig_user}';
$conf['db_password'] = '{mysql_server_ispconfig_password}';
@@ -72,6 +73,7 @@
define('DB_TYPE',$conf['db_type']);
define('DB_HOST',$conf['db_host']);
define('DB_PORT',$conf['db_port']);
define('DB_DATABASE',$conf['db_database']);
define('DB_USER',$conf['db_user']);
define('DB_PASSWORD',$conf['db_password']);
@@ -81,6 +83,7 @@
//** Database settings for the master DB. This setting is only used in multiserver setups
$conf['dbmaster_type']            = 'mysql';
$conf['dbmaster_host']            = '{mysql_master_server_host}';
$conf['dbmaster_host']          = '{mysql_master_server_port}';
$conf['dbmaster_database']        = '{mysql_master_server_database}';
$conf['dbmaster_user']            = '{mysql_master_server_ispconfig_user}';
$conf['dbmaster_password']        = '{mysql_master_server_ispconfig_password}';
install/tpl/debian6_dovecot-sql.conf.master
@@ -10,7 +10,7 @@
# );
driver = mysql
connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_server_ispconfig_user} password={mysql_server_ispconfig_password}
connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_server_ispconfig_user} password={mysql_server_ispconfig_password} port={mysql_server_port}
default_pass_scheme = CRYPT
# password-query with prefetch
install/tpl/debian_dovecot-sql.conf.master
@@ -117,7 +117,7 @@
#password_query = SELECT userid as user, password, home as userdb_home, uid as userdb_uid, gid as userdb_gid FROM users WHERE userid = '%u'
driver = mysql
connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_server_ispconfig_user} password={mysql_server_ispconfig_password}
connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_server_ispconfig_user} password={mysql_server_ispconfig_password} port={mysql_server_port}
default_pass_scheme = CRYPT
# password-query with prefetch
install/tpl/fedora_dovecot-sql.conf.master
@@ -130,7 +130,7 @@
#  FROM users WHERE userid = '%u'
driver = mysql
connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_server_ispconfig_user} password={mysql_server_ispconfig_password}
connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_server_ispconfig_user} password={mysql_server_ispconfig_password} port={mysql_server_port}
default_pass_scheme = CRYPT
# password-query with prefetch
install/tpl/mydns.conf.master
@@ -18,6 +18,7 @@
db-user = {mysql_server_ispconfig_user}             # SQL server username
db-password = {mysql_server_ispconfig_password}         # SQL server password
database = {mysql_server_database}          # MyDNS database name
db-port = {mysql_server_port}             # SQL server port
                                # GENERAL OPTIONS
install/tpl/opensuse_dovecot-sql.conf.master
@@ -130,7 +130,7 @@
#  FROM users WHERE userid = '%u'
driver = mysql
connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_server_ispconfig_user} password={mysql_server_ispconfig_password}
connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_server_ispconfig_user} password={mysql_server_ispconfig_password} port={mysql_server_port}
default_pass_scheme = CRYPT
# password-query with prefetch
install/tpl/pdns.local.master
@@ -7,6 +7,7 @@
gmysql-user={mysql_server_ispconfig_user}
gmysql-password={mysql_server_ispconfig_password}
gmysql-dbname={powerdns_database}
gmysql-port={mysql_server_port}
slave=yes
master=yes
install/update.php
@@ -247,13 +247,15 @@
    $finished = false;
    do {
        $tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host'],'mysql_master_hostname');
        $tmp_mysql_server_port = $inst->free_query('MySQL master server port', $conf['mysql']['master_port'],'mysql_master_port');
        $tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user'],'mysql_master_root_user');     
        $tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password'],'mysql_master_root_password');
        $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database');
        //* Initialize the MySQL server connection
        if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
        if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, (int)$tmp_mysql_server_port)) {
            $conf['mysql']['master_host'] = $tmp_mysql_server_host;
            $conf['mysql']['master_port'] = $tmp_mysql_server_port;
            $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user;
            $conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password;
            $conf['mysql']['master_database'] = $tmp_mysql_server_database;
interface/lib/classes/db_mysql.inc.php
@@ -36,6 +36,7 @@
    private $_iConnId;
    private $dbHost = '';  // hostname of the MySQL server
    private $dbPort = '';  // port of the MySQL server
    private $dbName = '';  // logical database name on that server
    private $dbUser = '';  // database authorized user
    private $dbPass = '';  // user's password
@@ -65,6 +66,7 @@
        global $conf;
        if($prefix != '') $prefix .= '_';
        $this->dbHost = $conf[$prefix.'db_host'];
        $this->dbPort = $conf[$prefix.'db_port'];
        $this->dbName = $conf[$prefix.'db_database'];
        $this->dbUser = $conf[$prefix.'db_user'];
        $this->dbPass = $conf[$prefix.'db_password'];
@@ -72,13 +74,13 @@
        $this->dbNewLink = $conf[$prefix.'db_new_link'];
        $this->dbClientFlags = $conf[$prefix.'db_client_flags'];
        $this->_iConnId = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass);
        $this->_iConnId = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass, (int)$this->dbPort);
        $try = 0;
        while((!is_object($this->_iConnId) || mysqli_connect_error()) && $try < 5) {
            if($try > 0) sleep(1);
            $try++;
            $this->_iConnId = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass);
            $this->_iConnId = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass, (int)$this->dbPort);
        }
        if(!is_object($this->_iConnId) || mysqli_connect_error()) {
@@ -240,7 +242,7 @@
            $try++;
            $ok = mysqli_ping($this->_iConnId);
            if(!$ok) {
                if(!mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName)) {
                if(!mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName, (int)$this->dbPort)) {
                    if($try > 4) {
                        $this->_sqlerror('DB::query -> reconnect');
                        return false;
interface/lib/config.inc.php
@@ -51,6 +51,7 @@
//** Database
$conf['db_type'] = 'mysql';
$conf['db_host'] = 'localhost';
$conf['db_port'] = 3306;
$conf['db_database'] = 'ispconfig3_305';
$conf['db_user'] = 'root';
$conf['db_password'] = '';
@@ -60,6 +61,7 @@
define('DB_TYPE', $conf['db_type']);
define('DB_HOST', $conf['db_host']);
define('DB_PORT', $conf['db_port']);
define('DB_DATABASE', $conf['db_database']);
define('DB_USER', $conf['db_user']);
define('DB_PASSWORD', $conf['db_password']);
@@ -69,6 +71,7 @@
//** Database settings for the master DB. This setting is only used in multiserver setups
$conf['dbmaster_type']   = 'mysql';
$conf['dbmaster_host']   = '{mysql_master_server_host}';
$conf['dbmaster_port']   = '{mysql_master_server_port}';
$conf['dbmaster_database']  = '{mysql_master_server_database}';
$conf['dbmaster_user']   = '{mysql_master_server_ispconfig_user}';
$conf['dbmaster_password']  = '{mysql_master_server_ispconfig_password}';
server/lib/app.inc.php
@@ -51,7 +51,7 @@
                    */
            if($conf['dbmaster_host'] != '' && ($conf['dbmaster_host'] != $conf['db_host'] || ($conf['dbmaster_host'] == $conf['db_host'] && $conf['dbmaster_database'] != $conf['db_database']))) {
                $this->dbmaster = new db($conf['dbmaster_host'], $conf['dbmaster_user'], $conf['dbmaster_password'], $conf['dbmaster_database']);
                $this->dbmaster = new db($conf['dbmaster_host'], $conf['dbmaster_user'], $conf['dbmaster_password'], $conf['dbmaster_database'], $conf['dbmaster_port']);
            } else {
                $this->dbmaster = $this->db;
            }
server/lib/classes/db_mysql.inc.php
@@ -36,6 +36,7 @@
    private $_iConnId;
    private $dbHost = '';  // hostname of the MySQL server
    private $dbPort = '';  // port of the MySQL server
    private $dbName = '';  // logical database name on that server
    private $dbUser = '';  // database authorized user
    private $dbPass = '';  // user's password
@@ -61,10 +62,11 @@
    */
    // constructor
    public function __construct($host = NULL , $user = NULL, $pass = NULL, $database = NULL) {
    public function __construct($host = NULL , $user = NULL, $pass = NULL, $database = NULL, $port = NULL) {
        global $app, $conf;
        $this->dbHost = $host ? $host  : $conf['db_host'];
        $this->dbPort = $port ? $port : $conf['db_port'];
        $this->dbName = $database ? $database : $conf['db_database'];
        $this->dbUser = $user ? $user : $conf['db_user'];
        $this->dbPass = $pass ? $pass : $conf['db_password'];
@@ -72,13 +74,13 @@
        $this->dbNewLink = $conf['db_new_link'];
        $this->dbClientFlags = $conf['db_client_flags'];
        $this->_iConnId = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass);
        $this->_iConnId = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass, (int)$this->dbPort);
        $try = 0;
        while((!is_object($this->_iConnId) || mysqli_connect_error()) && $try < 5) {
            if($try > 0) sleep(1);
            $try++;
            $this->_iConnId = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass);
            $this->_iConnId = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass, (int)$this->dbPort);
        }
        if(!is_object($this->_iConnId) || mysqli_connect_error()) {
@@ -193,7 +195,7 @@
            $try++;
            $ok = mysqli_ping($this->_iConnId);
            if(!$ok) {
                if(!mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName)) {
                if(!mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName, (int)$this->dbPort)) {
                    if($this->errorNumber == '111') {
                        // server is not available
                        if($try > 9) {