@ -7,7 +7,8 @@
( :export
#:take-snapshot
#:restore-from-snapshot
#:delete-snapshot ) )
#:delete-snapshot
#:store-snapshot ) )
( in-package #:snapshot )
( defun take-snapshot ( )
@ -37,3 +38,25 @@ user can repopulate that database after they have restored this website. The
( defun delete-snapshot ( snapshot-name )
"Deletes the snapshot in the /snapshots directory with `SNAPSHOT-NAME'."
( storage:remove-raw-directory ( format nil "snapshots/~a/" snapshot-name ) ) )
( defun store-snapshot ( filename data )
" Unzips ` SNAPSHOT-FILE ' and stores it in /snapshots directory.
The . zip file is deleted after it has been un-zipped. I did think about moving
the zipped version of the file into the /storage/media directory but there is
too much second guessing going on. I found I was uploading . zip files from the
/storage/media directory and I don 't know if users will be uploading . zip files
they had just downloaded from /storage/media. If that is the case, then there
is:
a. ) No need to move it to /storage/madia ;
b. ) Extra work regarding checks for duplicate entries ; and,
c. ) I don 't know if that is too much 'magic ' for users and cause confusion.
If the user is in a paniced state -- trying to restore their website, confusion
is the thing I want to keep to a minimum for them. "
( storage:store-with-raw-path ( format nil "snapshots/~a" filename ) data )
( zip:unzip ( storage:make-raw-path ( format nil "snapshots/~a" filename ) )
( storage:make-raw-path ( format nil "snapshots/~a/"
( pathname-name filename ) ) ) )
( storage:remove-file-with-raw-path ( format nil "snapshots/~a" filename ) ) )