diff --git a/install/data/footer.json b/install/data/footer.json
new file mode 100644
index 0000000000..69d55448ac
--- /dev/null
+++ b/install/data/footer.json
@@ -0,0 +1,10 @@
+[
+ {
+ "widget": "html",
+ "data" : {
+ "html": "",
+ "title":"",
+ "container":""
+ }
+ }
+]
\ No newline at end of file
diff --git a/src/install.js b/src/install.js
index 61f4bc56c0..45d44d75ad 100644
--- a/src/install.js
+++ b/src/install.js
@@ -394,13 +394,13 @@ function createWelcomePost(next) {
fs.readFile(path.join(__dirname, '../', 'install/data/welcome.md'), next);
},
function(next) {
- db.sortedSetCard('topics:tid', next);
+ db.getObjectField('global', 'topicCount', next);
}
], function(err, results) {
var content = results[0],
numTopics = results[1];
- if (numTopics === 0) {
+ if (!parseInt(numTopics, 10)) {
Topics.post({
uid: 1,
cid: 2,
@@ -430,12 +430,24 @@ function enableDefaultPlugins(next) {
function setCopyrightWidget(next) {
var db = require('./database');
-
- db.init(function(err) {
- if (!err) {
- db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"\",\"title\":\"\",\"container\":\"\"}}]", next);
+ async.parallel({
+ footerJSON: function(next) {
+ fs.readFile(path.join(__dirname, '../', 'install/data/footer.json'), next);
+ },
+ footer: function(next) {
+ db.getObjectField('widgets:global', 'footer', next);
}
- });
+ }, function(err, results) {
+ if (err) {
+ return next(err);
+ }
+
+ if (!results.footer && results.footerJSON) {
+ db.setObjectField('widgets:global', 'footer', results.footerJSON.toString(), next);
+ } else {
+ next();
+ }
+ });
}
install.setup = function (callback) {