Пример #1
0
         if (nas_can_user_manage_export($e)) {
             nas_export_update($_GET["id"], $_POST["quota_val"] * (2 << $NAS_UNITS_TR[$_POST["quota_unit"]]), $_SESSION["is_admin"] ? $_POST["user_editable"] : -1, $_SESSION["is_admin"] ? $_POST["type"] : NULL);
         }
         notify_user(_("Export Updated"), _("Export was successfully updated."));
     } else {
         notify_user(_("Export NOT updated"), _("Export was not updated."));
     }
     redirect('?page=nas');
     break;
 case "export_del":
     if (isset($_GET["id"])) {
         $e = nas_get_export_by_id($_GET["id"]);
         $mounts = nas_get_mounts_for_export($_GET["id"]);
         $msg = _("All data from this export will be DELETED!") . "<br>";
         $msg .= _("Current size:") . ' <strong>' . nas_size_to_humanreadable($e["export_used"]) . "</strong><br><br>";
         $children = nas_get_export_children($_GET["id"]);
         if (count($children) > 0) {
             $msg .= _("This export has following subdirectories and ALL OF THEM will be DELETED too:");
             $msg .= "<br><ul>";
             foreach ($children as $child) {
                 $mounts = array_merge($mounts, nas_get_mounts_for_export($child["id"]));
                 $msg .= "<li>" . $child["path"] . " (" . nas_size_to_humanreadable($child["used"]) . ")</li>";
             }
             $msg .= "</ul>";
         }
         if (count($mounts) > 0) {
             $msg .= _("Following mounts of these exports will be deleted too:") . "<ul>";
             foreach ($mounts as $m) {
                 $msg .= "<li> VPS #" . $m["vps_id"] . "; " . _("path") . " " . $m["dst"] . "</li>";
             }
             $msg .= "</ul>";
Пример #2
0
function nas_export_delete($id)
{
    global $db;
    $e = nas_get_export_by_id($id);
    $children = nas_get_export_children($id);
    $vpses = array();
    foreach ($children as $child) {
        nas_delete_export_mounts($child["id"], $vpses);
        nas_export_delete_direct($child["id"], false);
    }
    nas_delete_export_mounts($id, $vpses);
    nas_export_delete_direct($e, true);
    if ($e["default"] == "no") {
        $params = array("path" => $e["root_dataset"] . "/" . $e["dataset"], "recursive" => true);
        add_transaction($_SESSION["member"]["m_id"], $e["node_id"], 0, T_STORAGE_EXPORT_DELETE, $params);
        foreach ($vpses as $veid) {
            $vps = new vps_load($veid);
            $vps->mount_regen();
        }
    }
}