Skip to content

Commit

Permalink
fix(backup): crash on restore
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Jan 9, 2019
1 parent d68a045 commit a613612
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/backup/restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ function runRestore(file, callback) {
var platform = os.platform();
winston.info('Starting Restore... (' + platform + ')');

var options = ['--uri', CONNECTION_URI, '-d', databaseName, path.join(__dirname, '../../restores/restore_' + file, 'database/trudesk')];
var dbName = fs.readdirSync(path.join(__dirname, '../../restores/restore_' + file, 'database'))[0];
if (!dbName)
return callback(new Error('Invalid Backup. Unable to get DBName'));

var options = ['--uri', CONNECTION_URI, '-d', databaseName, path.join(__dirname, '../../restores/restore_' + file, 'database', dbName)];
var mongodump = null;
if (platform === 'win32')
mongodump = spawn(path.join(__dirname, 'bin', platform, 'mongorestore'), options);
Expand Down
3 changes: 3 additions & 0 deletions src/controllers/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var async = require('async'),
path = require('path'),
_ = require('lodash'),
winston = require('winston'),
pkg = require('../../package'),
Chance = require('chance');

var installController = {};
Expand All @@ -27,6 +28,8 @@ installController.index = function(req, res) {
content.title = 'Install Trudesk';
content.layout = false;

content.bottom = 'Trudesk v' + pkg.version;

res.render('install', content);
};

Expand Down
4 changes: 3 additions & 1 deletion src/controllers/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ var _ = require('lodash'),
path = require('path'),
passport = require('passport'),
winston = require('winston'),
nconf = require('nconf');

pkg = require('../../package');

var mainController = {};

Expand Down Expand Up @@ -45,6 +46,7 @@ mainController.index = function(req, res) {
if (settings.hasCustomPageLogo.value && settings.customPageLogoFilename.value.length > 0)
content.pageLogo = '/assets/' + settings.customPageLogoFilename.value;

content.bottom = 'Trudesk v' + pkg.version;

res.render('login', content);
});
Expand Down
13 changes: 13 additions & 0 deletions src/views/install.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,15 @@
stroke-width: 5;
stroke-linecap: round;
}
.bottom {
position: fixed;
bottom: 0;
left: 0;
font-size: 12px;
font-family: "Roboto", Arial, sans-serif;
margin: 0 0 5px 15px;
color: rgba(0,0,0,0.5);
}
</style>

<script src="/socket.io/socket.io.js"></script>
Expand Down Expand Up @@ -381,6 +390,10 @@
</div>
</div>

<div class="bottom">
{{bottom}}
</div>

<script type="text/javascript">
window.truRequire(['jquery', 'snackbar', 'helpers'], function(loadedModules) {
var $ = loadedModules[0];
Expand Down
13 changes: 13 additions & 0 deletions src/views/login.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@
.btn:hover, .btn:active, .btn:focus {
/*color: #222;*/
}
.bottom {
position: fixed;
bottom: 0;
left: 0;
font-size: 12px;
font-family: "Roboto", Arial, sans-serif;
margin: 0 0 5px 15px;
color: rgba(0,0,0,0.5);
}
</style>
<script src="/socket.io/socket.io.js"></script>
<script src="/js/vendor.js"></script>
Expand Down Expand Up @@ -203,6 +212,10 @@

</div>

<div class="bottom">
{{bottom}}
</div>

<script type="text/javascript">
window.truRequire(['jquery', 'helpers'], function(loadedModules) {
var $ = loadedModules[0];
Expand Down

0 comments on commit a613612

Please sign in to comment.