}
        if ($res) {
            if ($apply != "") {
                LocalRedirect("/bitrix/admin/cluster_dbnode_edit.php?ID=" . $ID . "&lang=" . LANGUAGE_ID . "&" . $tabControl->ActiveTabParam() . '&group_id=' . $group_id);
            } else {
                LocalRedirect("/bitrix/admin/cluster_dbnode_list.php?lang=" . LANGUAGE_ID . '&group_id=' . $group_id);
            }
        } else {
            if ($e = $APPLICATION->GetException()) {
                $message = new CAdminMessage(GetMessage("CLU_DBNODE_EDIT_SAVE_ERROR"), $e);
            }
            $bVarsFromForm = true;
        }
    } elseif ($delete != "" && $ID > 1) {
        $ob = new CClusterDBNode();
        $res = $ob->Delete($ID);
        if ($res) {
            LocalRedirect("/bitrix/admin/cluster_dbnode_list.php?lang=" . LANGUAGE_ID . '&group_id=' . $group_id);
        } else {
            $bVarsFromForm = true;
        }
    }
}
ClearVars("str_");
$str_ACTIVE = "Y";
$str_SORT = "10";
$str_NAME = "";
$str_DESCRIPTION = "";
$str_DB_HOST = "";
$str_DB_NAME = "";
$str_DB_LOGIN = "";
Ejemplo n.º 2
0
    }
}
$sTableID = "tbl_cluster_slave_list";
$oSort = new CAdminSorting($sTableID, "ID", "ASC");
$lAdmin = new CAdminList($sTableID, $oSort);
if ($arID = $lAdmin->GroupAction()) {
    foreach ($arID as $ID) {
        if (strlen($ID) <= 0) {
            continue;
        }
        $ID = IntVal($ID);
        switch ($_REQUEST['action']) {
            case "delete":
                $arNode = CClusterDBNode::GetByID($ID);
                if (is_array($arNode) && ($arNode["ROLE_ID"] == "SLAVE" || $arNode["ROLE_ID"] == "MASTER") && ($arNode["STATUS"] == "READY" || $arNode["STATUS"] == "PAUSED")) {
                    CClusterDBNode::Delete($arNode["ID"]);
                }
                break;
            case "pause":
                CClusterSlave::Pause($ID);
                break;
            case "resume":
                CClusterSlave::Resume($ID);
                break;
            case "stop":
                CClusterSlave::Stop($ID);
                break;
            case "skip_sql_error":
                CClusterSlave::SkipSQLError($ID);
                break;
        }