fixing LXC mysql_host trick, including local mysql using redir (to be documented ;) )
This commit is contained in:
parent
a481c85fb9
commit
c71e8db305
|
@ -86,7 +86,7 @@ class m_lxc implements vm {
|
||||||
* or FALSE if an error occurred. In that case $error[] is set.
|
* or FALSE if an error occurred. In that case $error[] is set.
|
||||||
*/
|
*/
|
||||||
private function sendMessage($params) {
|
private function sendMessage($params) {
|
||||||
global $L_FQDN;
|
global $L_FQDN,$hooks;
|
||||||
$fp = fsockopen($this->IP, $this->PORT, $errno, $errstr, $this->TIMEOUT);
|
$fp = fsockopen($this->IP, $this->PORT, $errno, $errstr, $this->TIMEOUT);
|
||||||
if (!$fp) {
|
if (!$fp) {
|
||||||
$this->error[] = 'Unable to connect';
|
$this->error[] = 'Unable to connect';
|
||||||
|
@ -95,9 +95,15 @@ class m_lxc implements vm {
|
||||||
// Authenticate:
|
// Authenticate:
|
||||||
$params['server']=$L_FQDN;
|
$params['server']=$L_FQDN;
|
||||||
$params['key']=$this->KEY;
|
$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) );
|
$msg = serialize($params);
|
||||||
if (fwrite ($fp, $msg) < 0) {
|
if (fwrite ($fp, $msg."\n") < 0) {
|
||||||
$this->error[] = 'Unable to send data';
|
$this->error[] = 'Unable to send data';
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
/** Hook function called by the quota class to compute user used quota
|
||||||
* Returns the used quota for the $name service for the current user.
|
* Returns the used quota for the $name service for the current user.
|
||||||
|
|
Loading…
Reference in New Issue