function build_aliases_maps()
{
    maillings_table();
    $alias_maps_cf = array();
    $alias_database_cf = array();
    $virtual_mailbox_maps_cf = array();
    $hash_mailman = null;
    $main = new maincf_multi();
    if (!isset($GLOBALS["alias_maps"])) {
        $GLOBALS["alias_maps"] = array();
    }
    if (!is_array($GLOBALS["alias_maps"])) {
        $GLOBALS["alias_maps"] = array();
    }
    if (count($GLOBALS["alias_maps"] == 0)) {
        aliases_users();
    }
    if (isset($GLOBALS["LDAPDBS"]["alias_maps"])) {
        if (is_array($GLOBALS["LDAPDBS"]["alias_maps"])) {
            if ($GLOBALS["VERBOSE"]) {
                "LDAP:: alias_maps = \"" . @implode(",", $GLOBALS["LDAPDBS"]["alias_maps"]) . "\n";
            }
            $alias_maps_cf = $GLOBALS["LDAPDBS"]["alias_maps"];
        } else {
            if ($GLOBALS["DEBUG"]) {
                echo __FUNCTION__ . "::LDAP:: GLOBALS[LDAPDBS][alias_maps]=not an array\n";
            }
        }
    }
    if (isset($GLOBALS["LDAPDBS"]["alias_database"])) {
        if (is_array($GLOBALS["LDAPDBS"]["alias_database"])) {
            $alias_database_cf = $GLOBALS["LDAPDBS"]["alias_database"];
        }
    }
    if (isset($GLOBALS["LDAPDBS"]["virtual_mailbox_maps"])) {
        if (is_array($GLOBALS["LDAPDBS"]["virtual_mailbox_maps"])) {
            $virtual_mailbox_maps_cf = $GLOBALS["LDAPDBS"]["virtual_mailbox_maps"];
        }
    }
    $contz = new postfix_extern();
    $contzdata = $contz->build_extern("master", "virtual_mailbox_maps");
    if ($contzdata != null) {
        $virtual_mailbox_maps_cf[] = $contzdata;
    }
    $alias_maps_cf[] = "hash:/etc/postfix/aliases";
    $alias_database_cf[] = "hash:/etc/postfix/aliases";
    echo "Starting......: " . date("H:i:s") . " Postfix " . count($GLOBALS["alias_maps"]) . " aliase(s)\n";
    @file_put_contents("/etc/postfix/aliases", implode("\n", $GLOBALS["alias_maps"]));
    shell_exec("{$GLOBALS["postalias"]} -c /etc/postfix hash:/etc/postfix/aliases >/dev/null 2>&1");
    shell_exec("{$GLOBALS["newaliases"]}");
    $extern = new postfix_extern();
    if ($GLOBALS["VERBOSE"]) {
        echo "*** Check external databases rules master/alias_maps ( line:" . __LINE__ . ")";
    }
    $aliases_extern = $extern->build_extern("master", "alias_maps");
    if ($aliases_extern != null) {
        $alias_database_cf[] = $aliases_extern;
    } else {
        if ($GLOBALS["VERBOSE"]) {
            echo "*** Check external databases rules master/alias_maps -> Nothing to add ( line:" . __LINE__ . ")";
        }
    }
    echo "Starting......: " . date("H:i:s") . " Postfix building alias_maps\n";
    shell_exec("{$GLOBALS["postconf"]} -e \"alias_maps =" . @implode(",", $alias_maps_cf) . "\" >/dev/null 2>&1");
    echo "Starting......: " . date("H:i:s") . " Postfix building alias_database\n";
    shell_exec("{$GLOBALS["postconf"]} -e \"alias_database =" . @implode(",", $alias_database_cf) . "\" >/dev/null 2>&1");
    if (count($virtual_mailbox_maps_cf) > 0) {
        echo "Starting......: " . date("H:i:s") . " Postfix building virtual_mailbox_maps\n";
        shell_exec("{$GLOBALS["postconf"]} -e \"virtual_mailbox_maps =" . @implode(",", $virtual_mailbox_maps_cf) . "\" >/dev/null 2>&1");
    } else {
        shell_exec("{$GLOBALS["postconf"]} -e \"virtual_mailbox_maps = \" >/dev/null 2>&1");
    }
}
    build_aliases_maps();
    build_virtual_alias_maps();
    postmaster();
    shell_exec("{$GLOBALS["postfix"]} reload >/dev/null 2>&1");
    die;
}
if ($argv[1] == "--smtp-passwords") {
    sender_canonical_maps_build();
    sender_canonical_maps();
    smtp_generic_maps();
    sender_dependent_relayhost_maps();
    smtp_sasl_password_maps();
    shell_exec("{$GLOBALS["postfix"]} reload >/dev/null 2>&1");
    die;
}
maillings_table();
aliases_users();
aliases();
catch_all();
build_aliases_maps();
build_virtual_alias_maps();
relais_domains_search();
build_relay_domains();
relay_recipient_maps_build();
recipient_canonical_maps_build();
recipient_canonical_maps();
sender_canonical_maps_build();
sender_canonical_maps();
smtp_generic_maps();
sender_dependent_relayhost_maps();
smtp_sasl_password_maps();
function cmdline_alias()
{
    LoadLDAPDBs();
    maillings_table();
    aliases_users();
    aliases();
    catch_all();
    build_aliases_maps();
    build_virtual_alias_maps();
    postmaster();
    recipient_canonical_maps_build();
    recipient_canonical_maps();
}