feat: import Sea vHost single-server testing release
This commit is contained in:
commit
248badd33e
441 files changed
+63221
No files matched your search
@@ -0,0 +1,33 @@
|
||||
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"}`))
|
||||
}
|
||||
Reference in new issue
Block a user