/* This is a debug tool. It checks all revisions for data corruption */ if(process.argv.length != 3) { console.error("Use: node checkPad.js $PADID"); process.exit(1); } //get the padID var padId = process.argv[2]; //initalize the database var log4js = require("../src/node_modules/log4js"); log4js.setGlobalLogLevel("INFO"); var async = require("../src/node_modules/async"); var db = require('../src/node/db/DB'); var Changeset = require("ep_etherpad-lite/static/js/Changeset"); var padManager; async.series([ //intallize the database function (callback) { db.init(callback); }, //get the pad function (callback) { padManager = require('../src/node/db/PadManager'); padManager.doesPadExists(padId, function(err, exists) { if(!exists) { console.error("Pad does not exist"); process.exit(1); } padManager.getPad(padId, function(err, _pad) { pad = _pad; callback(err); }); }); }, function (callback) { //create an array with key kevisions //key revisions always save the full pad atext var head = pad.getHeadRevisionNumber(); var keyRevisions = []; for(var i=0;i