Commit ad447c27 authored by Marius Burkard's avatar Marius Burkard

- store port in mysql_clientdb file

- use clientdb config for addon sql files
parent 94087a55
...@@ -2578,6 +2578,7 @@ class installer_base { ...@@ -2578,6 +2578,7 @@ class installer_base {
$content = str_replace('{hostname}', $conf['mysql']['host'], $content); $content = str_replace('{hostname}', $conf['mysql']['host'], $content);
$content = str_replace('{username}', $conf['mysql']['admin_user'], $content); $content = str_replace('{username}', $conf['mysql']['admin_user'], $content);
$content = str_replace('{password}', addslashes($conf['mysql']['admin_password']), $content); $content = str_replace('{password}', addslashes($conf['mysql']['admin_password']), $content);
$content = str_replace('{port}', addslashes($conf['mysql']['port']), $content);
wf($install_dir.'/server/lib/mysql_clientdb.conf', $content); wf($install_dir.'/server/lib/mysql_clientdb.conf', $content);
chmod($install_dir.'/server/lib/mysql_clientdb.conf', 0600); chmod($install_dir.'/server/lib/mysql_clientdb.conf', 0600);
chown($install_dir.'/server/lib/mysql_clientdb.conf', 'root'); chown($install_dir.'/server/lib/mysql_clientdb.conf', 'root');
......
...@@ -3,5 +3,6 @@ ...@@ -3,5 +3,6 @@
$clientdb_host = '{hostname}'; $clientdb_host = '{hostname}';
$clientdb_user = '{username}'; $clientdb_user = '{username}';
$clientdb_password = '{password}'; $clientdb_password = '{password}';
$clientdb_port = '{port}';
?> ?>
\ No newline at end of file
...@@ -119,12 +119,14 @@ class ispconfig_addon_installer_base { ...@@ -119,12 +119,14 @@ class ispconfig_addon_installer_base {
} }
} }
include '/usr/local/ispconfig/server/lib/mysql_clientdb.conf';
$app->log('Adding addon entry to db.', 0, false); $app->log('Adding addon entry to db.', 0, false);
// create addon entry if not existing // create addon entry if not existing
$qry = 'INSERT IGNORE INTO `addons` (`addon_ident`, `addon_version`, `addon_name`, `db_version`) VALUES (?, ?, ?, ?)'; $qry = 'INSERT IGNORE INTO `addons` (`addon_ident`, `addon_version`, `addon_name`, `db_version`) VALUES (?, ?, ?, ?)';
$app->db->query($qry, $this->addon_ident, $this->addon_version, $this->addon_name, 0); $app->db->query($qry, $this->addon_ident, $this->addon_version, $this->addon_name, 0);
$mysql_command = 'mysql --default-character-set=' . escapeshellarg($conf['db_charset']) . ' --force -h ' . escapeshellarg($conf['db_host']) . ' -u ' . escapeshellarg($conf['db_user']) . ' -p' . escapeshellarg($conf['db_password']) . ' -P ' . escapeshellarg($conf['db_port']) . ' -D ' . escapeshellarg($conf['db_database']); $mysql_command = 'mysql --default-character-set=' . escapeshellarg($conf['db_charset']) . ' --force -h ' . escapeshellarg($clientdb_host) . ' -u ' . escapeshellarg($clientdb_user) . ' -p' . escapeshellarg($clientdb_password) . ' -P ' . escapeshellarg($clientdb_port) . ' -D ' . escapeshellarg($conf['db_database']);
if($incremental === false) { if($incremental === false) {
$sql_file = $this->temp_dir . '/install/sql/' . $this->addon_ident . '.sql'; $sql_file = $this->temp_dir . '/install/sql/' . $this->addon_ident . '.sql';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment