function nas_delete_mounts_for_vps($veid) { global $db; $vps = new vps_load($veid); $rs = $db->query("SELECT * FROM vps_mount WHERE vps_id = '" . $db->check($veid) . "'"); while ($m = $db->fetch_array($rs)) { nas_mount_delete($m["id"], true, false); } $vps->mount_regen(); }
} redirect('?page=nas'); break; case "mount_del": if ($_GET["id"] && ($m = nas_get_mount_by_id($_GET["id"]))) { $vps = new vps_load($m["vps_id"]); if (nas_can_user_manage_mount($m, $vps)) { $xtpl->perex(_("Do you really want to delete mount") . ' ' . $m["dst"] . ' ' . _("at") . ' #' . $m["vps_id"] . '?', _("No data is deleted, only the mount.") . "<br><br>" . '<a href="?page=nas">' . strtoupper(_("No")) . '</a> | <a href="?page=nas&action=mount_del2&id=' . $_GET["id"] . '">' . strtoupper(_("Yes")) . '</a>'); } } break; case "mount_del2": if ($_GET["id"] && ($m = nas_get_mount_by_id($_GET["id"]))) { $vps = new vps_load($m["vps_id"]); if (nas_can_user_manage_mount($m, $vps)) { nas_mount_delete($_GET["id"], true); notify_user(_("Mount deleted"), _("Mount was successfully deleted.")); redirect('?page=nas'); } } break; case "mount": if ($_GET["id"]) { $m = nas_get_mount_by_id($_GET["id"]); $vps = new vps_load($m["vps_id"]); if (nas_can_user_manage_mount($m, $vps)) { $vps->mount($m); } notify_user(_("Mount scheduled."), ''); } else { notify_user(_("Mount id missing."), '');
break; case "nas_def_mount_edit_save": if ($_GET["id"] && ($_POST["export_id"] || $_POST["src"]) && $_POST["dst"]) { nas_mount_update($_GET["id"], $_POST["export_id"], $_POST["vps_id"], $_POST["access_mode"], $_POST["source_node_id"], $_POST["src"], $_POST["dst"], $_POST["m_opts"], $_POST["u_opts"], $_POST["type"], $_POST["cmd_premount"], $_POST["cmd_postmount"], $_POST["cmd_preumount"], $_POST["cmd_postumount"], false, true); notify_user(_("Default mount saved"), ''); redirect('?page=cluster&action=nas_settings'); } break; case "nas_def_mount_del": if ($_GET["id"] && ($m = nas_get_mount_by_id($_GET["id"]))) { $xtpl->perex(_("Do you really want to delete default mount") . ' ' . $m["dst"] . ' ' . _("at") . ' #' . $m["vps_id"] . '?', '<a href="?page=cluster&action=nas_settings">' . strtoupper(_("No")) . '</a> | <a href="?page=cluster&action=nas_def_mount_del2&id=' . $_GET["id"] . '">' . strtoupper(_("Yes")) . '</a>'); } break; case "nas_def_mount_del2": if ($_GET["id"] && ($m = nas_get_mount_by_id($_GET["id"]))) { nas_mount_delete($_GET["id"], false, false); notify_user(_("Default mount deleted"), _("Default mount was successfully deleted.")); redirect('?page=cluster&action=nas_settings'); } break; case "playground_settings": $xtpl->sbar_add(_("Back"), '?page=cluster'); $playground_settings = true; break; case "playground_settings_save": $xtpl->perex(_("Playground settings saved"), ''); $cluster_cfg->set("playground_enabled", (bool) $_POST["enabled"]); $cluster_cfg->set("playground_backup", (bool) $_POST["backup"]); $cluster_cfg->set("playground_vps_lifetime", (int) $_POST["lifetime"]); $playground_settings = true; break;