mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
@@ -23,8 +23,8 @@ func init() {
|
||||
}
|
||||
|
||||
// SaveAppStateContent saves the app state item to database
|
||||
func SaveAppStateContent(key, content string) error {
|
||||
return db.WithTx(db.DefaultContext, func(ctx context.Context) error {
|
||||
func SaveAppStateContent(ctx context.Context, key, content string) error {
|
||||
return db.WithTx(ctx, func(ctx context.Context) error {
|
||||
eng := db.GetEngine(ctx)
|
||||
// try to update existing row
|
||||
res, err := eng.Exec("UPDATE app_state SET revision=revision+1, content=? WHERE id=?", content, key)
|
||||
@@ -43,8 +43,8 @@ func SaveAppStateContent(key, content string) error {
|
||||
}
|
||||
|
||||
// GetAppStateContent gets an app state from database
|
||||
func GetAppStateContent(key string) (content string, err error) {
|
||||
e := db.GetEngine(db.DefaultContext)
|
||||
func GetAppStateContent(ctx context.Context, key string) (content string, err error) {
|
||||
e := db.GetEngine(ctx)
|
||||
appState := &AppState{ID: key}
|
||||
has, err := e.Get(appState)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user