Example #1
0
         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>";
         }
         $confirm = true;
         if ($e["export_used"] == 0 && count($children) == 0 && count($mounts) == 0) {
             $confirm = false;
         }
Example #2
0
function nas_delete_export_mounts($id, &$vpses)
{
    $mounts = nas_get_mounts_for_export($id);
    foreach ($mounts as $m) {
        nas_mount_delete($m["id"], true, false);
        if (!in_array($m["vps_id"], $vpses)) {
            $vpses[] = $m["vps_id"];
        }
    }
}