mirror of
https://github.com/documize/community.git
synced 2025-07-19 05:09:42 +02:00
Improve SMTP setting persistence
Should close #327 by providing better handling of non-english dialect(?).
This commit is contained in:
parent
3d0f17386b
commit
444b89e425
1 changed files with 7 additions and 8 deletions
|
@ -12,13 +12,13 @@
|
||||||
package setting
|
package setting
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/documize/community/domain/store"
|
"github.com/documize/community/domain/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Store provides data access to user permission information.
|
// Store provides data access to user permission information.
|
||||||
|
@ -57,15 +57,14 @@ func (s Store) Set(area, json string) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = tx.Exec(fmt.Sprintf("DELETE FROM dmz_config WHERE c_key = '%s'", area))
|
_, err = tx.Exec(s.Bind("DELETE FROM dmz_config WHERE c_key = ?"), area)
|
||||||
if err != nil && err != sql.ErrNoRows {
|
if err != nil && err != sql.ErrNoRows {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
s.Runtime.Log.Error(fmt.Sprintf("setting.Set %s", area), err)
|
s.Runtime.Log.Error(fmt.Sprintf("setting.Set %s", area), err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = tx.Exec(fmt.Sprintf("INSERT INTO dmz_config (c_key,c_config) VALUES ('%s','%s')",
|
_, err = tx.Exec(s.Bind("INSERT INTO dmz_config (c_key,c_config) VALUES (?, ?)"), area, json)
|
||||||
area, json))
|
|
||||||
if err != nil && err != sql.ErrNoRows {
|
if err != nil && err != sql.ErrNoRows {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
s.Runtime.Log.Error(fmt.Sprintf("setting.Set %s", area), err)
|
s.Runtime.Log.Error(fmt.Sprintf("setting.Set %s", area), err)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue