mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-05 06:09:20 +00:00
handle inS3 flag
This commit is contained in:
parent
daa42bcea0
commit
3bc5380468
3 changed files with 20 additions and 5 deletions
|
@ -28,7 +28,9 @@ module.exports = DocArchiveManager =
|
|||
else
|
||||
MongoAWS.archiveDocHistory project_id, doc_id, (error) ->
|
||||
logger.log doc_id:doc_id, error: error, "mongoexport"
|
||||
return callback()
|
||||
MongoManager.markDocHistoryAsArchived doc_id, (error) ->
|
||||
return callback(error) if error?
|
||||
callback()
|
||||
|
||||
unArchiveAllDocsChanges: (project_id, callback = (error, docs) ->) ->
|
||||
MongoManager.getProjectsDocs project_id, (error, docs) ->
|
||||
|
@ -47,4 +49,6 @@ module.exports = DocArchiveManager =
|
|||
else
|
||||
MongoAWS.unArchiveDocHistory project_id, doc_id, (error) ->
|
||||
logger.log doc_id:doc_id, error: error, "mongoimport"
|
||||
return callback()
|
||||
MongoManager.markDocHistoryAsUnarchived doc_id, (error) ->
|
||||
return callback(error) if error?
|
||||
callback()
|
||||
|
|
|
@ -11,11 +11,13 @@ module.exports = MongoAWS =
|
|||
archiveDocHistory: (project_id, doc_id, callback = (error) ->) ->
|
||||
MongoAWS.mongoExportDocHistory doc_id, (error, filepath) ->
|
||||
MongoAWS.s3upStream project_id, doc_id, filepath, callback
|
||||
#delete temp file?
|
||||
|
||||
unArchiveDocHistory: (project_id, doc_id, callback = (error) ->) ->
|
||||
MongoAWS.s3downStream project_id, doc_id, (error, filepath) ->
|
||||
if error == null
|
||||
MongoAWS.mongoImportDocHistory filepath, callback
|
||||
#delete temp file?
|
||||
else
|
||||
callback
|
||||
|
||||
|
|
|
@ -130,8 +130,17 @@ module.exports = MongoManager =
|
|||
getProjectsDocs: (project_id, callback)->
|
||||
db.docs.find project_id: ObjectId(project_id.toString()), {}, callback
|
||||
|
||||
getDocChanges: (doc_id, callback)->
|
||||
db.docHistory.find doc_id: ObjectId(doc_id.toString()), {}, callback
|
||||
|
||||
getDocChangesCount: (doc_id, callback)->
|
||||
db.docHistory.count doc_id: ObjectId(doc_id.toString()), {}, callback
|
||||
|
||||
markDocHistoryAsArchived: (doc_id, callback)->
|
||||
MongoManager.getLastCompressedUpdate doc_id, (error, update) ->
|
||||
db.docHistory.update { _id: update._id }, { $set : { inS3 : true } }, (error)->
|
||||
return callback(error) if error?
|
||||
db.docHistory.remove { doc_id : doc_id, inS3 : { $exists : false } }, (error)->
|
||||
return callback(error) if error?
|
||||
callback(error)
|
||||
|
||||
markDocHistoryAsUnarchived: (doc_id, callback)->
|
||||
db.docHistory.update { doc_id: doc_id }, { $unset : { inS3 : true } }, { multi: true }, (error)->
|
||||
callback(error)
|
||||
|
|
Loading…
Reference in a new issue