mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
force full sync when restoring from backup
This commit is contained in:
parent
b5c6a77c9f
commit
73f8d1a457
1 changed files with 5 additions and 2 deletions
|
@ -325,6 +325,7 @@ def setupApkgImport(mw, importer):
|
|||
if not full:
|
||||
# adding
|
||||
return True
|
||||
backup = re.match("backup-.*\\.apkg", base)
|
||||
if not askUser(_("""\
|
||||
This will delete your existing collection and replace it with the data in \
|
||||
the file you're importing. Are you sure?"""), msgfunc=QMessageBox.warning):
|
||||
|
@ -333,9 +334,9 @@ the file you're importing. Are you sure?"""), msgfunc=QMessageBox.warning):
|
|||
# called as part of the startup routine
|
||||
mw.progress.start(immediate=True)
|
||||
mw.progress.timer(
|
||||
100, lambda mw=mw, f=importer.file: replaceWithApkg(mw, f), False)
|
||||
100, lambda mw=mw, f=importer.file: replaceWithApkg(mw, f, backup), False)
|
||||
|
||||
def replaceWithApkg(mw, file):
|
||||
def replaceWithApkg(mw, file, backup):
|
||||
# unload collection, which will also trigger a backup
|
||||
mw.unloadCollection()
|
||||
# overwrite collection
|
||||
|
@ -351,4 +352,6 @@ def replaceWithApkg(mw, file):
|
|||
z.close()
|
||||
# reload
|
||||
mw.loadCollection()
|
||||
if backup:
|
||||
mw.col.modSchema(check=False)
|
||||
mw.progress.finish()
|
||||
|
|
Loading…
Reference in a new issue