mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
parent
65fb2bd401
commit
98e73395fc
@ -196,6 +196,9 @@ func (u *MysqlService) LoadFromRemote(req dto.MysqlLoadDB) error {
|
|||||||
for i := 0; i < len(databases); i++ {
|
for i := 0; i < len(databases); i++ {
|
||||||
if strings.EqualFold(databases[i].Name, data.Name) && strings.EqualFold(databases[i].MysqlName, data.MysqlName) {
|
if strings.EqualFold(databases[i].Name, data.Name) && strings.EqualFold(databases[i].MysqlName, data.MysqlName) {
|
||||||
hasOld = true
|
hasOld = true
|
||||||
|
if databases[i].IsDelete {
|
||||||
|
_ = mysqlRepo.Update(databases[i].ID, map[string]interface{}{"is_delete": false})
|
||||||
|
}
|
||||||
deleteList = append(deleteList[:i], deleteList[i+1:]...)
|
deleteList = append(deleteList[:i], deleteList[i+1:]...)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -222,6 +222,9 @@ func (u *PostgresqlService) LoadFromRemote(database string) error {
|
|||||||
for i := 0; i < len(databases); i++ {
|
for i := 0; i < len(databases); i++ {
|
||||||
if strings.EqualFold(databases[i].Name, data.Name) && strings.EqualFold(databases[i].PostgresqlName, data.PostgresqlName) {
|
if strings.EqualFold(databases[i].Name, data.Name) && strings.EqualFold(databases[i].PostgresqlName, data.PostgresqlName) {
|
||||||
hasOld = true
|
hasOld = true
|
||||||
|
if databases[i].IsDelete {
|
||||||
|
_ = postgresqlRepo.Update(databases[i].ID, map[string]interface{}{"is_delete": false})
|
||||||
|
}
|
||||||
deleteList = append(deleteList[:i], deleteList[i+1:]...)
|
deleteList = append(deleteList[:i], deleteList[i+1:]...)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,10 @@ func (r *Local) SyncDB(version string) ([]SyncDBInfo, error) {
|
|||||||
}
|
}
|
||||||
userLines, err := r.ExecSQLForRows(fmt.Sprintf("select user,host from mysql.db where db = '%s'", parts[0]), 300)
|
userLines, err := r.ExecSQLForRows(fmt.Sprintf("select user,host from mysql.db where db = '%s'", parts[0]), 300)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return datas, err
|
global.LOG.Debugf("sync user of db %s failed, err: %v", parts[0], err)
|
||||||
|
dataItem.Permission = "%"
|
||||||
|
datas = append(datas, dataItem)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
var permissionItem []string
|
var permissionItem []string
|
||||||
|
@ -332,7 +332,10 @@ func (r *Remote) SyncDB(version string) ([]SyncDBInfo, error) {
|
|||||||
}
|
}
|
||||||
userRows, err := r.Client.Query("select user,host from mysql.db where db = ?", dbName)
|
userRows, err := r.Client.Query("select user,host from mysql.db where db = ?", dbName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return datas, err
|
global.LOG.Debugf("sync user of db %s failed, err: %v", dbName, err)
|
||||||
|
dataItem.Permission = "%"
|
||||||
|
datas = append(datas, dataItem)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
var permissionItem []string
|
var permissionItem []string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user