mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
check db integrity on backup
This commit is contained in:
parent
6a8c19a889
commit
ec9a7c3755
1 changed files with 6 additions and 1 deletions
|
@ -3335,9 +3335,14 @@ nextFactor, reps, thinkingTime, yesCount, noCount from reviewHistory""")
|
|||
|
||||
def backup(modified, path):
|
||||
"""Path must not be unicode."""
|
||||
#path = os.path.join(backupDir, path)
|
||||
from anki.db import sqlite
|
||||
if not numBackups:
|
||||
return
|
||||
# check integrity
|
||||
con = sqlite.connect(path)
|
||||
if not con.execute("pragma integrity_check").fetchone() == ("ok",):
|
||||
raise DeckAccessError(_("Deck is corrupt."), type="corrupt")
|
||||
con.close()
|
||||
def escape(path):
|
||||
path = os.path.abspath(path)
|
||||
path = path.replace("\\", "!")
|
||||
|
|
Loading…
Reference in a new issue