🔥 移除旧版云端同步和备份功能入口 https://github.com/siyuan-note/siyuan/issues/5405

This commit is contained in:
Liang Ding 2022-07-13 20:39:10 +08:00
parent 2863e32cff
commit e936b9cf0b
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
5 changed files with 55 additions and 164 deletions

View file

@ -30,7 +30,6 @@ import (
"github.com/88250/gulu"
"github.com/dustin/go-humanize"
"github.com/siyuan-note/dejavu"
"github.com/siyuan-note/filelock"
"github.com/siyuan-note/siyuan/kernel/filesys"
"github.com/siyuan-note/siyuan/kernel/sql"
"github.com/siyuan-note/siyuan/kernel/treenode"
@ -211,47 +210,6 @@ func SetSyncMode(mode int) (err error) {
var syncLock = sync.Mutex{}
func getWorkspaceDataConf() (conf *filesys.DataConf, err error) {
conf = &filesys.DataConf{Updated: util.CurrentTimeMillis(), Device: Conf.System.ID}
confPath := filepath.Join(Conf.Sync.GetSaveDir(), ".siyuan", "conf.json")
if !gulu.File.IsExist(confPath) {
os.MkdirAll(filepath.Dir(confPath), 0755)
data, _ := gulu.JSON.MarshalIndentJSON(conf, "", " ")
if err = filelock.NoLockFileWrite(confPath, data); nil != err {
util.LogErrorf("save sync conf [%s] failed: %s", confPath, err)
}
return
}
data, err := filelock.NoLockFileRead(confPath)
if nil != err {
util.LogErrorf("read sync conf [%s] failed: %s", confPath, err)
return
}
if err = gulu.JSON.UnmarshalJSON(data, conf); nil != err {
filesys.IncWorkspaceDataVer(false, Conf.System.ID) // 尝试恢复 data/.siyuan/conf.json
util.LogErrorf("unmarshal sync conf [%s] failed: %s", confPath, err)
err = errors.New(Conf.Language(84))
return
}
return
}
func incLocalSyncVer() {
conf, err := getWorkspaceDataConf()
if nil != err {
return
}
conf.SyncVer++
data, _ := gulu.JSON.MarshalIndentJSON(conf, "", " ")
confPath := filepath.Join(Conf.Sync.GetSaveDir(), ".siyuan", "conf.json")
if err = gulu.File.WriteFileSafer(confPath, data, 0644); nil != err {
util.LogErrorf("save sync conf [%s] failed: %s", confPath, err)
}
return
}
func CreateCloudSyncDir(name string) (err error) {
syncLock.Lock()
defer syncLock.Unlock()
@ -389,23 +347,6 @@ func getIgnoreLines() (ret []string) {
return
}
func GetSyncDirection(cloudDirName string) (code int, msg string) { // 0失败10上传20下载30一致40使用数据仓库同步
if !IsSubscriber() {
return
}
if "" == cloudDirName {
return
}
if !IsValidCloudDirName(cloudDirName) {
return
}
// TODO: 彻底移除方向判断
return 40, ""
}
func IncWorkspaceDataVer() {
filesys.IncWorkspaceDataVer(true, Conf.System.ID)
syncSameCount = 0