MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / SaveSettingItem

Function SaveSettingItem

internal/op/setting.go:172–187  ·  view source on GitHub ↗
(item *model.SettingItem)

Source from the content-addressed store, hash-verified

170}
171
172func SaveSettingItem(item *model.SettingItem) (err error) {
173 if it, ok := MigrationSettingItems[item.Key]; ok &&
174 item.Value == it.MigrationValue {
175 item.Value = it.Value
176 }
177 // hook
178 if _, err := HandleSettingItemHook(item); err != nil {
179 return fmt.Errorf("failed to execute hook on %s: %+v", item.Key, err)
180 }
181 // update
182 if err = db.SaveSettingItem(item); err != nil {
183 return fmt.Errorf("failed save setting on %s: %+v", item.Key, err)
184 }
185 SettingCacheUpdate()
186 return nil
187}
188
189func DeleteSettingItemByKey(key string) error {
190 old, err := GetSettingItemByKey(key)

Callers 3

WriteProgressFunction · 0.92
initSettingsFunction · 0.92
ResetTokenFunction · 0.92

Calls 3

SaveSettingItemFunction · 0.92
HandleSettingItemHookFunction · 0.85
SettingCacheUpdateFunction · 0.85

Tested by

no test coverage detected