当前位置: 首页>>代码示例>>PHP>>正文


PHP sockets::SET_CLUSTER方法代码示例

本文整理汇总了PHP中sockets::SET_CLUSTER方法的典型用法代码示例。如果您正苦于以下问题:PHP sockets::SET_CLUSTER方法的具体用法?PHP sockets::SET_CLUSTER怎么用?PHP sockets::SET_CLUSTER使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sockets的用法示例。


在下文中一共展示了sockets::SET_CLUSTER方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: NotifyStatus

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");
    }
}
开发者ID:brucewu16899,项目名称:artica,代码行数:86,代码来源:exec.gluster.php


注:本文中的sockets::SET_CLUSTER方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。