diff --git a/backend/app/service/container.go b/backend/app/service/container.go index 96e58f522..53ec906e1 100644 --- a/backend/app/service/container.go +++ b/backend/app/service/container.go @@ -874,7 +874,6 @@ func calculateNetwork(network map[string]types.NetworkStats) (float64, float64) func checkImageExist(client *client.Client, imageItem string) bool { images, err := client.ImageList(context.Background(), image.ListOptions{}) if err != nil { - fmt.Println(err) return false } diff --git a/backend/app/service/docker.go b/backend/app/service/docker.go index c531721ce..b0ea6e52d 100644 --- a/backend/app/service/docker.go +++ b/backend/app/service/docker.go @@ -4,7 +4,6 @@ import ( "bufio" "context" "encoding/json" - "fmt" "os" "path" "strings" @@ -104,7 +103,6 @@ func (u *DockerService) LoadDockerConf() *dto.DaemonJsonConf { return &data } if err := json.Unmarshal(arr, &conf); err != nil { - fmt.Println(err) return &data } if _, ok := daemonMap["iptables"]; !ok { diff --git a/backend/app/service/ftp.go b/backend/app/service/ftp.go index 879a9655f..22664b920 100644 --- a/backend/app/service/ftp.go +++ b/backend/app/service/ftp.go @@ -1,7 +1,6 @@ package service import ( - "fmt" "os" "github.com/1Panel-dev/1Panel/backend/app/dto" @@ -128,7 +127,9 @@ func (f *FtpService) Sync() error { func (f *FtpService) Create(req dto.FtpCreate) (uint, error) { if _, err := os.Stat(req.Path); err != nil { if os.IsNotExist(err) { - fmt.Println(os.MkdirAll(req.Path, os.ModePerm)) + if err := os.MkdirAll(req.Path, os.ModePerm); err != nil { + return 0, err + } } else { return 0, err } diff --git a/backend/utils/mysql/client/remote.go b/backend/utils/mysql/client/remote.go index 1229c2f5d..a1e4476b5 100644 --- a/backend/utils/mysql/client/remote.go +++ b/backend/utils/mysql/client/remote.go @@ -252,7 +252,7 @@ func (r *Remote) Backup(info BackupInfo) error { backupCmd := fmt.Sprintf("docker run --rm --net=host -i %s /bin/bash -c '%s -h %s -P %d -u%s -p%s %s --default-character-set=%s %s'", image, dumpCmd, r.Address, r.Port, r.User, r.Password, sslSkip(info.Version, r.Type), info.Format, info.Name) - global.LOG.Debug(backupCmd) + global.LOG.Debug(strings.ReplaceAll(backupCmd, r.Password, "******")) cmd := exec.Command("bash", "-c", backupCmd) var stderr bytes.Buffer cmd.Stderr = &stderr @@ -281,7 +281,7 @@ func (r *Remote) Recover(info RecoverInfo) error { recoverCmd := fmt.Sprintf("docker run --rm --net=host -i %s /bin/bash -c '%s -h %s -P %d -u%s -p%s %s --default-character-set=%s %s'", image, r.Type, r.Address, r.Port, r.User, r.Password, sslSkip(info.Version, r.Type), info.Format, info.Name) - global.LOG.Debug(recoverCmd) + global.LOG.Debug(strings.ReplaceAll(recoverCmd, r.Password, "******")) cmd := exec.Command("bash", "-c", recoverCmd) if strings.HasSuffix(info.SourceFile, ".gz") { @@ -419,11 +419,11 @@ func (r *Remote) ExecSQLForHosts(timeout uint) ([]string, error) { func loadImage(dbType, version string) (string, error) { cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) if err != nil { - fmt.Println(err) + return "", err } images, err := cli.ImageList(context.Background(), image.ListOptions{}) if err != nil { - fmt.Println(err) + return "", err } for _, image := range images { @@ -445,10 +445,20 @@ func loadImage(dbType, version string) (string, error) { } } } - if dbType == "mariadb" || version == "8.x" { - return "mysql:8.2.0", nil + return loadVersion(dbType, version), nil +} + +func loadVersion(dbType string, version string) string { + if dbType == "mariadb" { + return "mariadb:11.3.2 " } - return "mysql:" + version, nil + if strings.HasPrefix(version, "5.6") { + return "mysql:5.6.51" + } + if strings.HasPrefix(version, "5.7") { + return "mysql:5.7.44" + } + return "mysql:8.2.0" } func sslSkip(version, dbType string) string {