mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
This commit is contained in:
parent
c88268fbfd
commit
3a36def366
9 changed files with 22 additions and 25 deletions
|
|
@ -1006,7 +1006,7 @@
|
|||
"104": "The update installation package failed to download, please check the network connection",
|
||||
"105": "Corrupted data repo have been automatically reset",
|
||||
"106": "Maximum length is limited to 512 characters",
|
||||
"107": "Moving document [%s]",
|
||||
"107": "Moved document [%s]",
|
||||
"108": "Data sync found conflicts, you can view the generated conflict content in [Data History]",
|
||||
"109": "Remove reminder completed [%s]",
|
||||
"110": "Renaming...",
|
||||
|
|
|
|||
|
|
@ -1006,7 +1006,7 @@
|
|||
"104": "El paquete de instalación de la actualización no se pudo descargar, verifique la conexión de red",
|
||||
"105": "El repositorio de datos corruptos se ha restablecido automáticamente",
|
||||
"106": "La longitud máxima está limitada a 512 caracteres",
|
||||
"107": "Moviendo documento [%s]",
|
||||
"107": "Documento movido [%s]",
|
||||
"108": "La sincronizaci\u00f3n de datos encontr\u00f3 en conflictos, puede ver el contenido del conflicto generado en [Historial de datos]",
|
||||
"109": "Eliminación de recordatorios completada [%s]",
|
||||
"110": "Renombrar...",
|
||||
|
|
|
|||
|
|
@ -1006,7 +1006,7 @@
|
|||
"104": "Le package d'installation de la mise à jour n'a pas pu être téléchargé, veuillez vérifier la connexion réseau",
|
||||
"105": "Le référentiel de données corrompu a été automatiquement réinitialisé",
|
||||
"106": "La longueur maximale est limitée à 512 caractères",
|
||||
"107": "Déplacement du document [%s]",
|
||||
"107": "Document déplacé [%s]",
|
||||
"108": "La synchronisation des données a trouvé des conflits, vous pouvez afficher le contenu du conflit généré dans [Historique des données]",
|
||||
"109": "Supprimer le rappel terminé [%s]",
|
||||
"110": "Renommer...",
|
||||
|
|
|
|||
|
|
@ -1006,7 +1006,7 @@
|
|||
"104": "更新安裝包下載失敗,請檢查網絡連接",
|
||||
"105": "已經自動重置損壞的數據倉庫",
|
||||
"106": "最大長度限制為 512 字元",
|
||||
"107": "正在移動文檔 [%s]",
|
||||
"107": "已經移動文檔 [%s]",
|
||||
"108": "數據同步發現衝突,可在 [數據歷史] 中查看生成的衝突內容",
|
||||
"109": "移除提醒完畢 [%s]",
|
||||
"110": "正在重命名...",
|
||||
|
|
|
|||
|
|
@ -1006,7 +1006,7 @@
|
|||
"104": "更新安装包下载失败,请检查网络连接",
|
||||
"105": "已经自动重置损坏的数据仓库",
|
||||
"106": "最大长度限制为 512 字符",
|
||||
"107": "正在移动文档 [%s]",
|
||||
"107": "已经移动文档 [%s]",
|
||||
"108": "数据同步发现冲突,可在 [数据历史] 中查看生成的冲突内容",
|
||||
"109": "移除提醒完毕 [%s]",
|
||||
"110": "正在重命名...",
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ func (box *Box) moveTrees0(files []*FileInfo) {
|
|||
}
|
||||
|
||||
treenode.SetBlockTreePath(subTree)
|
||||
sql.UpsertTreeQueue(subTree)
|
||||
sql.RenameTreeQueue(subTree)
|
||||
msg := fmt.Sprintf(Conf.Language(107), subTree.HPath)
|
||||
util.PushStatusBar(msg)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -882,11 +882,11 @@ func indexWriteJSONQueueWithoutChangeTime(tree *parse.Tree) (err error) {
|
|||
return writeJSONQueueWithoutChangeTime(tree)
|
||||
}
|
||||
|
||||
func renameWriteJSONQueue(tree *parse.Tree, oldHPath string) (err error) {
|
||||
func renameWriteJSONQueue(tree *parse.Tree) (err error) {
|
||||
if err = filesys.WriteTree(tree); nil != err {
|
||||
return
|
||||
}
|
||||
sql.RenameTreeQueue(tree, oldHPath)
|
||||
sql.RenameTreeQueue(tree)
|
||||
treenode.IndexBlockTree(tree)
|
||||
return
|
||||
}
|
||||
|
|
@ -1288,12 +1288,10 @@ func RenameDoc(boxID, p, title string) (err error) {
|
|||
}
|
||||
title = strings.ReplaceAll(title, "/", "")
|
||||
|
||||
oldHPath := tree.HPath
|
||||
tree.HPath = path.Join(path.Dir(tree.HPath), title)
|
||||
tree.Root.SetIALAttr("title", title)
|
||||
tree.Root.SetIALAttr("updated", util.CurrentTimeSecondsStr())
|
||||
|
||||
if err = renameWriteJSONQueue(tree, oldHPath); nil != err {
|
||||
if err = renameWriteJSONQueue(tree); nil != err {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1097,18 +1097,18 @@ func batchDeleteByPathPrefix(tx *sql.Tx, boxID, pathPrefix string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func batchUpdateHPath(tx *sql.Tx, boxID, rootID, oldHPath, newHPath string) (err error) {
|
||||
stmt := "UPDATE blocks SET hpath = ? WHERE box = ? AND root_id = ? AND hpath = ?"
|
||||
if err = execStmtTx(tx, stmt, newHPath, boxID, rootID, oldHPath); nil != err {
|
||||
func batchUpdateHPath(tx *sql.Tx, boxID, rootID, newHPath string) (err error) {
|
||||
stmt := "UPDATE blocks SET hpath = ? WHERE box = ? AND root_id = ?"
|
||||
if err = execStmtTx(tx, stmt, newHPath, boxID, rootID); nil != err {
|
||||
return
|
||||
}
|
||||
stmt = "UPDATE blocks_fts SET hpath = ? WHERE box = ? AND root_id = ? AND hpath = ?"
|
||||
if err = execStmtTx(tx, stmt, newHPath, boxID, rootID, oldHPath); nil != err {
|
||||
stmt = "UPDATE blocks_fts SET hpath = ? WHERE box = ? AND root_id = ?"
|
||||
if err = execStmtTx(tx, stmt, newHPath, boxID, rootID); nil != err {
|
||||
return
|
||||
}
|
||||
if !caseSensitive {
|
||||
stmt = "UPDATE blocks_fts_case_insensitive SET hpath = ? WHERE box = ? AND root_id = ? AND hpath = ?"
|
||||
if err = execStmtTx(tx, stmt, newHPath, boxID, rootID, oldHPath); nil != err {
|
||||
stmt = "UPDATE blocks_fts_case_insensitive SET hpath = ? WHERE box = ? AND root_id = ?"
|
||||
if err = execStmtTx(tx, stmt, newHPath, boxID, rootID); nil != err {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ type dbQueueOperation struct {
|
|||
removeTreeIDs []string // delete_ids
|
||||
box string // delete_box/delete_box_refs/index
|
||||
renameTree *parse.Tree // rename
|
||||
renameTreeOldHPath string // rename
|
||||
block *Block // update_block_content
|
||||
removeAssetHashes []string // delete_assets
|
||||
}
|
||||
|
|
@ -168,7 +167,7 @@ func execOp(op *dbQueueOperation, tx *sql.Tx, context map[string]interface{}) (e
|
|||
case "delete_ids":
|
||||
err = batchDeleteByRootIDs(tx, op.removeTreeIDs, context)
|
||||
case "rename":
|
||||
err = batchUpdateHPath(tx, op.renameTree.Box, op.renameTree.ID, op.renameTreeOldHPath, op.renameTree.HPath)
|
||||
err = batchUpdateHPath(tx, op.renameTree.Box, op.renameTree.ID, op.renameTree.HPath)
|
||||
if nil != err {
|
||||
break
|
||||
}
|
||||
|
|
@ -303,15 +302,15 @@ func UpsertTreeQueue(tree *parse.Tree) {
|
|||
operationQueue = append(operationQueue, newOp)
|
||||
}
|
||||
|
||||
func RenameTreeQueue(tree *parse.Tree, oldHPath string) {
|
||||
func RenameTreeQueue(tree *parse.Tree) {
|
||||
dbQueueLock.Lock()
|
||||
defer dbQueueLock.Unlock()
|
||||
|
||||
newOp := &dbQueueOperation{
|
||||
renameTree: tree,
|
||||
renameTreeOldHPath: oldHPath,
|
||||
inQueueTime: time.Now(),
|
||||
action: "rename"}
|
||||
action: "rename",
|
||||
}
|
||||
for i, op := range operationQueue {
|
||||
if "rename" == op.action && op.renameTree.ID == tree.ID { // 相同树则覆盖
|
||||
operationQueue[i] = newOp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue