示例#1
0
function build_all_aliases()
{
    MysqlInstancesList();
    if (!is_array($GLOBALS["INSTANCES_LIST"])) {
        echo "Starting......: " . date("H:i:s") . " Postfix No instances, aborting\n";
        return;
    }
    reset($GLOBALS["INSTANCES_LIST"]);
    while (list($num, $ligne) = each($GLOBALS["INSTANCES_LIST"])) {
        $hostname = $ligne;
        echo "Starting......: " . date("H:i:s") . " Postfix \"{$hostname}\" checking aliases\n";
        $maincf = new maincf_multi($hostname);
        $maincf->buildconf();
        $results = array();
        exec("{$GLOBALS["postmulti"]} -i postfix-{$hostname} -p reload 2>&1", $results);
        while (list($a, $b) = each($results)) {
            echo "Starting......: " . date("H:i:s") . " Postfix \"{$hostname}\" {$b}\n";
        }
    }
}
function restart_all_instances()
{
    $unix = new unix();
    $postfix = $unix->find_program("postfix");
    $GLOBALS["postmulti"] = $unix->find_program("postmulti");
    echo "Starting......: Stopping master instance\n";
    system("{$postfix} stop");
    if ($sock->GET_INFO("EnablePostfixMultiInstance") == 1) {
        $main = new maincf_multi(null);
        $main->PostfixMainCfDefaultInstance();
    }
    echo "Starting......: checking first instance security\n";
    system("{$postfix} -c /etc/postfix set-permissions");
    $sock = new sockets();
    if ($sock->GET_INFO("EnablePostfixMultiInstance") == 1) {
        echo "Starting......: checking all instances security\n";
        MysqlInstancesList();
        if (is_array($GLOBALS["INSTANCES_LIST"])) {
            while (list($num, $ligne) = each($GLOBALS["INSTANCES_LIST"])) {
                echo "Starting......: checking instance {$ligne} security\n";
                system("{$postfix} -c /etc/postfix-{$ligne} set-permissions");
            }
        }
        echo "Starting......: Starting master\n";
        system("{$postfix} stop");
        system("{$postfix} start");
        reset($GLOBALS["INSTANCES_LIST"]);
        while (list($num, $hostname) = each($GLOBALS["INSTANCES_LIST"])) {
            _start_instance($hostname);
        }
    } else {
        echo "Starting......: Starting master\n";
        system("{$postfix} start");
    }
}