diff --git a/bureau/class/m_lxc.php b/bureau/class/m_lxc.php index 55919a69..1c6e71ae 100644 --- a/bureau/class/m_lxc.php +++ b/bureau/class/m_lxc.php @@ -86,7 +86,7 @@ class m_lxc implements vm { * or FALSE if an error occurred. In that case $error[] is set. */ private function sendMessage($params) { - global $L_FQDN; + global $L_FQDN,$hooks; $fp = fsockopen($this->IP, $this->PORT, $errno, $errstr, $this->TIMEOUT); if (!$fp) { $this->error[] = 'Unable to connect'; @@ -95,9 +95,15 @@ class m_lxc implements vm { // Authenticate: $params['server']=$L_FQDN; $params['key']=$this->KEY; + // MySQL Host for this user ? + $moreparams=$hooks->invoke("lxc_params",array($params)); + foreach($moreparams as $p) { + foreach($p as $k=>$v) + $params[$k]=$v; + } - $msg = sprintf("%s\n", $crypto->encrypt(serialize($params), $this->KEY) ); - if (fwrite ($fp, $msg) < 0) { + $msg = serialize($params); + if (fwrite ($fp, $msg."\n") < 0) { $this->error[] = 'Unable to send data'; return FALSE; } diff --git a/bureau/class/m_mysql.php b/bureau/class/m_mysql.php index 78411e10..f0946983 100644 --- a/bureau/class/m_mysql.php +++ b/bureau/class/m_mysql.php @@ -958,6 +958,25 @@ class m_mysql { } + /* ----------------------------------------------------------------- */ + /** Hook function called by the lxc class to set mysql_host and port + * parameters + * @param $name string name of the quota + * @return integer the number of service used or false if an error occured + * @access private + */ + function hook_lxc_params($params) { + global $err; + $err->log("mysql","alternc_get_quota"); + $p=array(); + if (isset($this->dbus["Host"]) && $this->dbus["Host"]!="") { + $p["mysql_host"] = $this->dbus["Host"]; + $p["mysql_port"] = 3306; + } + return $p; + } + + /* ----------------------------------------------------------------- */ /** Hook function called by the quota class to compute user used quota * Returns the used quota for the $name service for the current user.