function NotifyStatus() { $users = new usersMenus(); $master = @file_get_contents("/etc/artica-cluster/master"); $server = $master; $sock = new sockets(); if (trim($master) == null) { writelogs("Unable to get the master ", __FUNCTION__, __FILE__, __LINE__); return null; } if ($GLOBALS["VERBOSE"]) { echo "NotifyStatus() start...\n"; } if (!$users->GLUSTER_INSTALLED) { if ($GLOBALS["VERBOSE"]) { echo "GLUSTER_INSTALLED=false\n"; } die; } $gluster = new GlusterClient(); $unix = new unix(); $filetemp = $unix->FILE_TEMP(); if ($GLOBALS["VERBOSE"]) { echo "/usr/share/artica-postfix/bin/artica-install --gluster-status >{$filetemp} 2>&1\n"; } shell_exec("/usr/share/artica-postfix/bin/artica-install --gluster-status >{$filetemp} 2>&1"); $ini = new Bs_IniHandler(); $ini->loadFile($filetemp); while (list($num, $ligne) = each($ini->_params["GLUSTER"])) { $orders[$num] = $ligne; writelogs("order {$num}={$ligne}", __FUNCTION__, __FILE__, __LINE__); if ($GLOBALS["VERBOSE"]) { echo "order {$num}={$ligne}\n"; } } @unlink($filetemp); if ($GLOBALS["VERBOSE"]) { echo "my name is {$gluster->PARAMS["name"]}\n"; } $orders["NTFY_STATUS"] = $gluster->PARAMS["name"]; $orders["bricks"] = implode(",", $gluster->CLUSTERED_BRIKS); $folders = $gluster->CLUSTERED_FOLDERS; while (list($num, $ligne) = each($folders)) { $orders[$num] = $ligne; } $curl = new glusterCurl("https://{$server}:9000/exec.gluster.php"); $curl->parms = $orders; if ($GLOBALS["VERBOSE"]) { echo "sending infos to {$server}\n"; } if (!$curl->get()) { writelogs("curl error !"); return null; } if (preg_match("#DELETE_YOU#is", $curl->data)) { shell_exec("/etc/init.d/artica-postfix stop gluster"); shell_exec("/bin/rm -f /etc/artica-cluster/*"); $sock->getFrameWork("cmd.php?reconfigure-cyrus=yes"); return null; } if (preg_match("#CYRUS-ID=(.*?);#is", $curl->data, $re)) { writelogs("Master cyrus id =\"{$re[1]}\"", __FUNCTION__, __FILE__, __LINE__); $sock->SET_CLUSTER('cyrus_id', $re[1]); $cyrus_id = $sock->getFrameWork("cmd.php?idofUser=cyrus"); if ($cyrus_id != $re[1]) { writelogs("cyrus id \"{$re[1]}\" is different of my cyrus id {$cyrus_id} (restart cyrus)", __FUNCTION__, __FILE__, __LINE__); $sock->getFrameWork("cmd.php?reconfigure-cyrus=yes"); } str_replace("CYRUS-ID={$re[1]};", "", $curl->data); } $data = explode(";", $curl->data); if (is_array($data)) { while (list($index, $computer) = each($data)) { if ($computer == null) { continue; } if (!is_file("/etc/artica-cluster/clusters-{$computer}")) { $mustRestart = true; GetCLusterCLientInfos($computer); } } } if ($mustRestart) { shell_exec("/etc/init.d/artica-postfix restart gluster"); } }