mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-25 20:51:23 +03:00
Typo fix (#4290)
This commit is contained in:
parent
466c765df5
commit
2529b35094
@ -172,14 +172,14 @@ function CreateMeshCentralServer(config, args) {
|
|||||||
|
|
||||||
// Fix a NeDB database
|
// Fix a NeDB database
|
||||||
if (obj.args.dbfix) {
|
if (obj.args.dbfix) {
|
||||||
var lines = null, badJsonCount = 0, feildNames = [], fixedDb = [];
|
var lines = null, badJsonCount = 0, fieldNames = [], fixedDb = [];
|
||||||
try { lines = obj.fs.readFileSync(obj.getConfigFilePath(obj.args.dbfix), { encoding: 'utf8' }).split('\n'); } catch (ex) { console.log('Invalid file: ' + obj.args.dbfix + ': ' + ex); process.exit(); }
|
try { lines = obj.fs.readFileSync(obj.getConfigFilePath(obj.args.dbfix), { encoding: 'utf8' }).split('\n'); } catch (ex) { console.log('Invalid file: ' + obj.args.dbfix + ': ' + ex); process.exit(); }
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
var x = null;
|
var x = null;
|
||||||
try { x = JSON.parse(lines[i]); } catch (ex) { badJsonCount++; }
|
try { x = JSON.parse(lines[i]); } catch (ex) { badJsonCount++; }
|
||||||
if (x != null) { fixedDb.push(lines[i]); for (var j in x) { if (feildNames.indexOf(j) == -1) { feildNames.push(j); } } }
|
if (x != null) { fixedDb.push(lines[i]); for (var j in x) { if (fieldNames.indexOf(j) == -1) { fieldNames.push(j); } } }
|
||||||
}
|
}
|
||||||
console.log('Lines: ' + lines.length + ', badJSON: ' + badJsonCount + ', Feilds: ' + feildNames);
|
console.log('Lines: ' + lines.length + ', badJSON: ' + badJsonCount + ', Feilds: ' + fieldNames);
|
||||||
obj.fs.writeFileSync(obj.getConfigFilePath(obj.args.dbfix) + '-fixed', fixedDb.join('\n'), { encoding: 'utf8' });
|
obj.fs.writeFileSync(obj.getConfigFilePath(obj.args.dbfix) + '-fixed', fixedDb.join('\n'), { encoding: 'utf8' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user