package isolation import ( "context" "encoding/json" "io" "net/http" "path/filepath" ) func (c *Client) PruneRuntimeBackups(ctx context.Context) error { return c.requestLong(ctx, "/v1/runtime/backups/prune", struct{}{}, nil) } func (a Agent) pruneRuntimeBackups(w http.ResponseWriter, r *http.Request) { var input struct{} decoder := json.NewDecoder(r.Body) decoder.DisallowUnknownFields() if decoder.Decode(&input) != nil || decoder.Decode(&struct{}{}) != io.EOF { http.Error(w, "invalid prune request", 400) return } base := a.BackupRoot if base == "" { base = "/www/backup/sea-vhost" } if !filepath.IsAbs(base) || filepath.Clean(base) != base { http.Error(w, "invalid backup root", 500) return } a.prunePHPSnapshots(filepath.Join(base, "runtime", "php")) w.Header().Set("Content-Type", "application/json") _, _ = w.Write([]byte(`{"status":"ok"}`)) }