kopia lustrzana https://github.com/dgtlmoon/changedetection.io
Backups - Hide incomplete/running backups from being downloaded
rodzic
33c83230a6
commit
942625e1fb
|
@ -22,7 +22,7 @@ def create_backup(datastore_path, watches: dict):
|
||||||
backupname = BACKUP_FILENAME_FORMAT.format(timestamp)
|
backupname = BACKUP_FILENAME_FORMAT.format(timestamp)
|
||||||
backup_filepath = os.path.join(datastore_path, backupname)
|
backup_filepath = os.path.join(datastore_path, backupname)
|
||||||
|
|
||||||
with zipfile.ZipFile(backup_filepath, "w",
|
with zipfile.ZipFile(backup_filepath.replace('.zip', '.tmp'), "w",
|
||||||
compression=zipfile.ZIP_DEFLATED,
|
compression=zipfile.ZIP_DEFLATED,
|
||||||
compresslevel=8) as zipObj:
|
compresslevel=8) as zipObj:
|
||||||
|
|
||||||
|
@ -70,6 +70,9 @@ def create_backup(datastore_path, watches: dict):
|
||||||
compresslevel=8,
|
compresslevel=8,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Now it's done, rename it so it shows up finally and its completed being written.
|
||||||
|
os.rename(backup_filepath.replace('.zip', '.tmp'), backup_filepath.replace('.tmp', '.zip'))
|
||||||
|
|
||||||
|
|
||||||
def construct_blueprint(datastore: ChangeDetectionStore):
|
def construct_blueprint(datastore: ChangeDetectionStore):
|
||||||
backups_blueprint = Blueprint('backups', __name__, template_folder="templates")
|
backups_blueprint = Blueprint('backups', __name__, template_folder="templates")
|
||||||
|
|
Ładowanie…
Reference in New Issue