/* This is a debug tool. It helps to extract all datas of a pad and move it from an productive enviroment and to a develop enviroment to reproduce bugs there. It outputs a dirtydb file */ if(process.argv.length != 3) { console.error("Use: node extractPadData.js $PADID"); process.exit(1); } //get the padID var padId = process.argv[2]; var db, dirty, padManager, pad; var neededDBValues = ["pad:"+padId]; var npm = require("../src/node_modules/npm"); var async = require("../src/node_modules/async"); var log4js = require("../src/node_modules/log4js"); log4js.setGlobalLogLevel("INFO"); async.series([ // load npm function(callback) { npm.load({}, function(er) { callback(er) }) }, // load modules function(callback) { db = require('../src/node/db/DB'); dirty = require("../src/node_modules/ueberDB/node_modules/dirty")(padId + ".db"); }, //intallize the database function (callback) { db.init(callback); }, //get the pad function (callback) { padManager = require('../node/db/PadManager'); padManager.getPad(padId, function(err, _pad) { pad = _pad; callback(err); }); }, function (callback) { //add all authors var authors = pad.getAllAuthors(); for(var i=0;i