2016-12-02 09:01:19 -05:00
|
|
|
Settings = require "settings-sharelatex"
|
|
|
|
fs = require("fs")
|
|
|
|
mongojs = require("mongojs")
|
|
|
|
ObjectId = mongojs.ObjectId
|
|
|
|
db = mongojs(Settings.mongo.url, ['users'])
|
|
|
|
_ = require("underscore")
|
|
|
|
|
2016-12-02 09:12:52 -05:00
|
|
|
|
2016-12-02 09:01:19 -05:00
|
|
|
handleExit = () ->
|
|
|
|
console.log('Got signal. Shutting down.')
|
|
|
|
|
2016-12-02 09:12:52 -05:00
|
|
|
|
2016-12-02 09:01:19 -05:00
|
|
|
process.on 'SIGINT', handleExit
|
|
|
|
process.on 'SIGHUP', handleExit
|
|
|
|
|
2016-12-02 09:12:52 -05:00
|
|
|
|
|
|
|
exports.migrate = (client, done=()->) ->
|
2016-12-02 09:01:19 -05:00
|
|
|
patch = {
|
|
|
|
$set: {
|
|
|
|
features: {
|
|
|
|
collaborators: -1
|
|
|
|
dropbox: true
|
|
|
|
versioning: true
|
|
|
|
references: true
|
|
|
|
templates: true
|
|
|
|
compileTimeout: 180
|
|
|
|
compileGroup: "standard"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log ">> updating all user features: ", patch
|
|
|
|
db.users.update {}, patch, {multi: true}, (err) ->
|
|
|
|
console.log "finished updating all user features"
|
|
|
|
return done(err)
|
2016-12-02 09:12:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
exports.rollback = (client, done) ->
|
|
|
|
done()
|