all: sync with master; upd chlog
This commit is contained in:
35
internal/confmigrate/v1.go
Normal file
35
internal/confmigrate/v1.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package confmigrate
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/AdguardTeam/golibs/errors"
|
||||
"github.com/AdguardTeam/golibs/log"
|
||||
)
|
||||
|
||||
// migrateTo1 performs the following changes:
|
||||
//
|
||||
// # BEFORE:
|
||||
// # …
|
||||
//
|
||||
// # AFTER:
|
||||
// 'schema_version': 1
|
||||
// # …
|
||||
//
|
||||
// It also deletes the unused dnsfilter.txt file, since the following versions
|
||||
// store filters in data/filters/.
|
||||
func (m *Migrator) migrateTo1(diskConf yobj) (err error) {
|
||||
diskConf["schema_version"] = 1
|
||||
|
||||
dnsFilterPath := filepath.Join(m.workingDir, "dnsfilter.txt")
|
||||
log.Printf("deleting %s as we don't need it anymore", dnsFilterPath)
|
||||
err = os.Remove(dnsFilterPath)
|
||||
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
log.Info("warning: %s", err)
|
||||
|
||||
// Go on.
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user