From b057759eae7a15b41e4f50539d4d5e6f54a5d780 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Fri, 9 Nov 2012 22:06:26 +0100 Subject: [PATCH] Fix #1142 error in bin/migrateDirtyDBtoMySQL.js npm must be npm.load'ed before using it --- bin/migrateDirtyDBtoMySQL.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/bin/migrateDirtyDBtoMySQL.js b/bin/migrateDirtyDBtoMySQL.js index f2bc8efe..d0273de0 100644 --- a/bin/migrateDirtyDBtoMySQL.js +++ b/bin/migrateDirtyDBtoMySQL.js @@ -1,11 +1,17 @@ -var dirty = require("../src/node_modules/ueberDB/node_modules/dirty")('var/dirty.db'); -var db = require("../src/node/db/DB"); +require("ep_etherpad-lite/node_modules/npm").load({}, function(er,npm) { -db.init(function() { - db = db.db; - dirty.on("load", function() { - dirty.forEach(function(key, value) { - db.set(key, value); + process.chdir(npm.root+'/..') + + var dirty = require("ep_etherpad-lite/node_modules/ueberDB/node_modules/dirty")('var/dirty.db'); + var db = require("ep_etherpad-lite/node/db/DB"); + + db.init(function() { + db = db.db; + dirty.on("load", function() { + dirty.forEach(function(key, value) { + db.set(key, value); + }); }); }); + });