mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-07 16:12:53 +01:00
Merge pull request #4338 from pichalite/theme-reset
add argument to theme reset to specify theme
This commit is contained in:
30
src/reset.js
30
src/reset.js
@@ -16,7 +16,11 @@ Reset.reset = function() {
|
||||
}
|
||||
|
||||
if (nconf.get('t')) {
|
||||
resetThemes();
|
||||
if(nconf.get('t') === true) {
|
||||
resetThemes();
|
||||
} else {
|
||||
resetTheme(nconf.get('t'));
|
||||
}
|
||||
} else if (nconf.get('p')) {
|
||||
if (nconf.get('p') === true) {
|
||||
resetPlugins();
|
||||
@@ -46,8 +50,8 @@ Reset.reset = function() {
|
||||
process.stdout.write(' -s\tsettings\n');
|
||||
process.stdout.write(' -a\tall of the above\n');
|
||||
|
||||
process.stdout.write('\nPlugin reset flag (-p) can take a single argument\n');
|
||||
process.stdout.write(' e.g. ./nodebb reset -p nodebb-plugin-mentions\n');
|
||||
process.stdout.write('\nPlugin and theme reset flags (-p & -t) can take a single argument\n');
|
||||
process.stdout.write(' e.g. ./nodebb reset -p nodebb-plugin-mentions, ./nodebb reset -t nodebb-theme-persona\n');
|
||||
process.exit();
|
||||
}
|
||||
});
|
||||
@@ -65,6 +69,26 @@ function resetSettings(callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function resetTheme(themeId) {
|
||||
var meta = require('./meta');
|
||||
var fs = require('fs');
|
||||
|
||||
fs.access('node_modules/' + themeId + '/package.json', function(err, fd) {
|
||||
if (err) {
|
||||
winston.warn('[reset] Theme `%s` is not installed on this forum', themeId);
|
||||
process.exit();
|
||||
} else {
|
||||
meta.themes.set({
|
||||
type: 'local',
|
||||
id: themeId
|
||||
}, function(err) {
|
||||
winston.info('[reset] Theme reset to ' + themeId);
|
||||
process.exit();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function resetThemes(callback) {
|
||||
var meta = require('./meta');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user