mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
Added init hook to install plugin database default content and the like
This commit is contained in:
parent
4325f0b907
commit
8cd1298a16
1 changed files with 24 additions and 1 deletions
|
@ -93,6 +93,28 @@ if (exports.isClient) {
|
|||
}
|
||||
} else {
|
||||
|
||||
exports.callInit = function (cb) {
|
||||
var hooks = require("./hooks");
|
||||
async.map(
|
||||
Object.keys(exports.plugins),
|
||||
function (plugin_name, cb) {
|
||||
var plugin = exports.plugins[plugin_name];
|
||||
fs.stat(path.normalize(path.join(plugin.package.path, ".ep_initialized")), function (err, stats) {
|
||||
if (err) {
|
||||
async.waterfall([
|
||||
function (cb) { fs.writeFile(path.normalize(path.join(plugin.package.path, ".ep_initialized")), 'done', cb); },
|
||||
function (cb) { hooks.aCallAll("init_" + plugin_name, {}, cb); },
|
||||
cb,
|
||||
]);
|
||||
} else {
|
||||
cb();
|
||||
}
|
||||
});
|
||||
},
|
||||
function () { cb(); }
|
||||
);
|
||||
}
|
||||
|
||||
exports.update = function (cb) {
|
||||
exports.getPackages(function (er, packages) {
|
||||
var parts = [];
|
||||
|
@ -104,11 +126,12 @@ exports.update = function (cb) {
|
|||
exports.loadPlugin(packages, plugin_name, plugins, parts, cb);
|
||||
},
|
||||
function (err) {
|
||||
if (err) cb(err);
|
||||
exports.plugins = plugins;
|
||||
exports.parts = exports.sortParts(parts);
|
||||
exports.hooks = exports.extractHooks(exports.parts, "hooks");
|
||||
exports.loaded = true;
|
||||
cb(err);
|
||||
exports.callInit(cb);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue