當前位置: 首頁>>代碼示例>>PHP>>正文


PHP maincf_multi::ConfigureMilters方法代碼示例

本文整理匯總了PHP中maincf_multi::ConfigureMilters方法的典型用法代碼示例。如果您正苦於以下問題:PHP maincf_multi::ConfigureMilters方法的具體用法?PHP maincf_multi::ConfigureMilters怎麽用?PHP maincf_multi::ConfigureMilters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在maincf_multi的用法示例。


在下文中一共展示了maincf_multi::ConfigureMilters方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: MultiplesInstances_start

function MultiplesInstances_start($hostname, $ou)
{
    $hostname = trim($hostname);
    if ($hostname == null) {
        if ($GLOBALS["VERBOSE"]) {
            echo "{$GLOBALS["deflog_start"]} milter-greylist (" . __FUNCTION__ . ") return -> hostname is null\n";
        }
        return;
    }
    $unix = new unix();
    echo "{$GLOBALS["deflog_start"]} milter-greylist hostname:{$hostname} OU:({$ou}) line: " . __LINE__ . "\n";
    $main = new maincf_multi($hostname, $ou);
    $array_filters = unserialize(base64_decode($main->GET_BIGDATA("PluginsEnabled")));
    if ($array_filters["APP_MILTERGREYLIST"] == 0) {
        $enabled = false;
    }
    $pid = MultiplesInstancesPID($hostname);
    if ($unix->process_exists($pid)) {
        echo "{$GLOBALS["deflog_start"]} milter-greylist {$hostname} already running PID {$pid}\n";
        return;
    }
    echo "{$GLOBALS["deflog_start"]} milter-greylist hostname \"{$hostname}\" line: " . __LINE__ . "\n";
    $bin_path = $unix->find_program("milter-greylist");
    @mkdir("/var/spool/postfix/var/run/milter-greylist/{$hostname}", 0755, true);
    @mkdir("/var/milter-greylist/{$hostname}", 666, true);
    if (!is_file("/var/milter-greylist/{$hostname}/greylist.db")) {
        @file_put_contents("/var/milter-greylist/{$hostname}/greylist.db", " ");
    }
    shell_exec("/bin/chmod 644 /var/milter-greylist/{$hostname}/greylist.db");
    if (!is_file("/etc/milter-greylist/{$hostname}/greylist.conf")) {
        echo "{$GLOBALS["deflog_start"]} milter-greylist {$hostname} /etc/milter-greylist/{$hostname}/greylist.conf does not exists\n";
        MultiplesInstances($hostname, $ou);
        return;
    }
    $cmdline = "{$bin_path} -P /var/spool/postfix/var/run/milter-greylist/{$hostname}/greylist.pid";
    $cmdline = $cmdline . " -p /var/spool/postfix/var/run/milter-greylist/{$hostname}/greylist.sock";
    $cmdline = $cmdline . " -d /var/milter-greylist/{$hostname}/greylist.db";
    $cmdline = $cmdline . " -f /etc/milter-greylist/{$hostname}/greylist.conf";
    if ($GLOBALS["VERBOSE"]) {
        echo "{$GLOBALS["deflog_start"]} milter-greylist {$cmdline}\n";
    }
    system($cmdline);
    for ($i = 0; $i < 20; $i++) {
        $pid = MultiplesInstancesPID($hostname);
        if ($unix->process_exists($pid)) {
            echo "{$GLOBALS["deflog_start"]} milter-greylist {$hostname} started PID {$pid}\n";
            break;
        }
        sleep(1);
    }
    $pid = MultiplesInstancesPID($hostname);
    if ($unix->process_exists($pid)) {
        $main->ConfigureMilters();
    }
    for ($i = 0; $i < 10; $i++) {
        if (is_file("/var/spool/postfix/var/run/milter-greylist/{$hostname}/greylist.sock")) {
            break;
        }
        echo "{$GLOBALS["deflog_start"]} milter-greylist waiting greylist.sock ({$i}/10)\n";
        sleep(1);
    }
    @chown("/var/spool/postfix/var/run/milter-greylist", "postfix");
    @chgrp("/var/spool/postfix/var/run/milter-greylist", "postfix");
    @chown("/var/spool/postfix/var/run/milter-greylist/{$hostname}/greylist.sock", "postfix");
    @chmod("/var/spool/postfix/var/run/milter-greylist/{$hostname}/greylist.sock", 0777);
    @chmod("/var/spool/postfix/var/run/milter-greylist", 0755);
    $unix->chown_func("postfix", "postfix", "/var/spool/postfix/var/run/milter-greylist/*");
    $unix->chown_func("postfix", "postfix", "/var/spool/postfix/var/run/milter-greylist/{$hostname}");
    $unix->chown_func("postfix", "postfix", "/var/spool/postfix/var/run/milter-greylist/{$hostname}/greylist.sock");
}
開發者ID:brucewu16899,項目名稱:1.6.x,代碼行數:70,代碼來源:exec.milter-greylist.php


注:本文中的maincf_multi::ConfigureMilters方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。