mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-07 11:00:09 +08:00
🎨 Automatically loads and indexes from the file system when a block is not found https://github.com/siyuan-note/siyuan/issues/10772
This commit is contained in:
parent
b3d581718b
commit
50eef7d1e6
@ -181,6 +181,7 @@ func searchTreeInFilesystem(rootID string) {
|
|||||||
msdID := util.PushMsg(Conf.language(45), 7000)
|
msdID := util.PushMsg(Conf.language(45), 7000)
|
||||||
defer util.PushClearMsg(msdID)
|
defer util.PushClearMsg(msdID)
|
||||||
|
|
||||||
|
logging.LogWarnf("searching tree on filesystem [rootID=%s]", rootID)
|
||||||
var treePath string
|
var treePath string
|
||||||
filepath.Walk(util.DataDir, func(path string, info fs.FileInfo, err error) error {
|
filepath.Walk(util.DataDir, func(path string, info fs.FileInfo, err error) error {
|
||||||
if info.IsDir() {
|
if info.IsDir() {
|
||||||
@ -204,6 +205,7 @@ func searchTreeInFilesystem(rootID string) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if "" == treePath {
|
if "" == treePath {
|
||||||
|
logging.LogErrorf("tree not found on filesystem [rootID=%s]", rootID)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,4 +226,5 @@ func searchTreeInFilesystem(rootID string) {
|
|||||||
treenode.IndexBlockTree(tree)
|
treenode.IndexBlockTree(tree)
|
||||||
sql.IndexTreeQueue(tree)
|
sql.IndexTreeQueue(tree)
|
||||||
sql.WaitForWritingDatabase()
|
sql.WaitForWritingDatabase()
|
||||||
|
logging.LogInfof("reindexed tree by filesystem [rootID=%s]", rootID)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user