diff --git a/.gitignore b/.gitignore index e743a14466..58bdac0c9d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ feeds/recent.rss # winston? error.log events.log + +pidfile diff --git a/loader.js b/loader.js index 2263955ef9..3bb103d417 100644 --- a/loader.js +++ b/loader.js @@ -1,26 +1,65 @@ -var fork = require('child_process').fork, - start = function() { - nbb = fork('./app', process.argv.slice(2), { - env: { - 'NODE_ENV': process.env.NODE_ENV - } - }); +"use strict"; - nbb.on('message', function(cmd) { - if (cmd === 'nodebb:restart') { - nbb.on('exit', function() { - start(); +var nconf = require('nconf'), + fs = require('fs'), + pidFilePath = __dirname + '/pidfile', + start = function() { + var fork = require('child_process').fork, + nbb_start = function() { + nbb = fork('./app', process.argv.slice(2), { + env: { + 'NODE_ENV': process.env.NODE_ENV + } + }); + + nbb.on('message', function(cmd) { + if (cmd === 'nodebb:restart') { + nbb.on('exit', function() { + nbb_start(); + }); + nbb.kill(); + } }); + }, + nbb_stop = function() { nbb.kill(); - } - }); - }, - stop = function() { - nbb.kill(); + if (fs.existsSync(pidFilePath)) { + var pid = parseInt(fs.readFileSync(pidFilePath, { encoding: 'utf-8' }), 10); + if (process.pid === pid) { + fs.unlinkSync(pidFilePath); + } + } + }; + + process.on('SIGINT', nbb_stop); + process.on('SIGTERM', nbb_stop); + + nbb_start(); }, nbb; -process.on('SIGINT', stop); -process.on('SIGTERM', stop); +nconf.argv(); -start(); \ No newline at end of file +if (nconf.get('d')) { + // Check for a still-active NodeBB process + if (fs.existsSync(pidFilePath)) { + console.log('\n Error: Another NodeBB is already running!'); + process.exit(); + } + + // Initialise logging streams + var outputStream = fs.createWriteStream(__dirname + '/logs/output.log'); + outputStream.on('open', function(fd) { + // Daemonize + require('daemon')({ + stdout: fd + }); + + // Write its pid to a pidfile + fs.writeFile(__dirname + '/pidfile', process.pid); + + start(); + }); +} else { + start(); +} \ No newline at end of file diff --git a/logs/.gitignore b/logs/.gitignore new file mode 100644 index 0000000000..397b4a7624 --- /dev/null +++ b/logs/.gitignore @@ -0,0 +1 @@ +*.log diff --git a/nodebb b/nodebb index 0ea67b0a69..107d96259e 100755 --- a/nodebb +++ b/nodebb @@ -6,7 +6,19 @@ case "$1" in start) - node loader "$@" + echo "Starting NodeBB"; + echo " \"./nodebb stop\" to stop the NodeBB server"; + echo " \"./nodebb log\" to view server output"; + node loader -d "$@" + ;; + + stop) + echo "Stopping NodeBB. Goodbye!"; + kill `cat pidfile`; + ;; + + log) + tail -F ./logs/output.log; ;; upgrade) @@ -42,13 +54,17 @@ case "$1" in *) echo "Welcome to NodeBB" - echo $"Usage: $0 {start|dev|watch|upgrade}" + echo $"Usage: $0 {start|stop|log|setup|reset|upgrade|dev|watch}" echo '' column -s ' ' -t <<< ' - start Start NodeBB in production mode - dev Start NodeBB in development mode - watch Start NodeBB in development mode and watch for changes + start Start the NodeBB server + stop Stops the NodeBB server + log Opens the logging interface (useful for debugging) + setup Runs the NodeBB setup script + reset Disables all plugins, restores the default theme. upgrade Run NodeBB upgrade scripts, ensure packages are up-to-date + dev Start NodeBB in interactive development mode + watch Start NodeBB in development mode and watch for changes ' exit 1 esac diff --git a/package.json b/package.json index 221a6a781a..fec5bc2bab 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,8 @@ }, "main": "app.js", "scripts": { + "start": "./nodebb start", + "stop": "./nodebb stop", "test": "mocha ./tests" }, "dependencies": { @@ -43,7 +45,8 @@ "nodebb-theme-vanilla": "~0.0.14", "nodebb-theme-cerulean": "~0.0.13", "nodebb-theme-lavender": "~0.0.22", - "less": "^1.6.3" + "less": "^1.6.3", + "daemon": "~1.1.0" }, "optionalDependencies": { "redis": "0.8.3", diff --git a/public/language/pt_BR/global.json b/public/language/pt_BR/global.json index 26d5525a81..efb6b78f23 100644 --- a/public/language/pt_BR/global.json +++ b/public/language/pt_BR/global.json @@ -10,14 +10,16 @@ "500.message": "Oops! deu algo errado!", "register": "Cadastrar", "login": "Logar", - "welcome_back": "Welcome Back ", - "you_have_successfully_logged_in": "You have successfully logged in", + "please_log_in": "Por favor efetue o login", + "posting_restriction_info": "Postagens esta restritas para membros registrados. clique aqui para logar", + "welcome_back": "Bem vindo de volta", + "you_have_successfully_logged_in": "Você logou com sucesso", "logout": "Logout", "logout.title": "Logout com sucesso.", "logout.message": "Logado com Sucesso!", "save_changes": "Salvar Alterações", "close": "Fechar", - "pagination": "Pagination", + "pagination": "Paginação", "header.admin": "Admin", "header.recent": "Recente", "header.unread": "Não Lido", @@ -52,5 +54,5 @@ "dnd": "Não Perturbe", "invisible": "Invisível", "offline": "Offline", - "privacy": "Privacy" + "privacy": "Privacidade" } \ No newline at end of file diff --git a/public/language/pt_BR/notifications.json b/public/language/pt_BR/notifications.json index fa7441b08d..253ec3cfdd 100644 --- a/public/language/pt_BR/notifications.json +++ b/public/language/pt_BR/notifications.json @@ -1,7 +1,7 @@ { "title": "Notificações", - "no_notifs": "You have no new notifications", - "see_all": "See all Notifications", + "no_notifs": "Você não tem nenhuma notificação nova", + "see_all": "Visualizar todas as Notificações", "back_to_home": "voltar para home", "outgoing_link": "Link Externo", "outgoing_link_message": "Você está; saindo para um link externo", diff --git a/public/language/pt_BR/pages.json b/public/language/pt_BR/pages.json index 8f6d6f08e8..313eee0d2c 100644 --- a/public/language/pt_BR/pages.json +++ b/public/language/pt_BR/pages.json @@ -1,7 +1,7 @@ { "home": "Home", "unread": "Tópicos Não Lidos", - "popular": "Popular Topics", + "popular": "Tópicos Populares", "recent": "Tópicos Recentes", "users": "Usuários Registrados", "notifications": "Notificações", diff --git a/public/language/pt_BR/recent.json b/public/language/pt_BR/recent.json index b67b2e88b4..9adf191ed6 100644 --- a/public/language/pt_BR/recent.json +++ b/public/language/pt_BR/recent.json @@ -3,5 +3,5 @@ "day": "Dia", "week": "Semana", "month": "Mês", - "no_recent_topics": "There are no recent topics." + "no_recent_topics": "Nenhum tópico recente." } \ No newline at end of file diff --git a/public/language/pt_BR/topic.json b/public/language/pt_BR/topic.json index a20ea66672..0e01e879f4 100644 --- a/public/language/pt_BR/topic.json +++ b/public/language/pt_BR/topic.json @@ -2,7 +2,7 @@ "topic": "Tópico", "topics": "Tópicos", "no_topics_found": "Nenhum tópico encontrado!", - "no_posts_found": "No posts found!", + "no_posts_found": "Nenhum post encontrado!", "profile": "Profile", "posted_by": "Postado por", "chat": "Bate Papo", @@ -19,19 +19,24 @@ "tools": "Ferramentas", "flag": "Marcar", "flag_title": "Marcar este post para moderação", - "deleted_message": "This thread has been deleted. Only users with thread management privileges can see it.", - "watch": "Watch", - "share_this_post": "Share this Post", + "deleted_message": "Esta Thread foi deletada. Somente usuários com privilégios administrativos podem ver.", + "following_topic.title": "Seguir Tópico", + "following_topic.message": "Você receberá notificações quando alguém responder este tópico.", + "not_following_topic.title": "Não está seguindo Tópico", + "not_following_topic.message": "Você não irá mais receber notificações deste tópico.", + "login_to_subscribe": "Por favor registre ou logue para poder assinar este tópico", + "watch": "Acompanhar", + "share_this_post": "Compartilhar este Post", "thread_tools.title": "Ferramentas da Thread", "thread_tools.markAsUnreadForAll": "Marcar como não lido", - "thread_tools.pin": "Pin Topic", - "thread_tools.unpin": "Unpin Topic", - "thread_tools.lock": "Lock Topic", - "thread_tools.unlock": "Unlock Topic", - "thread_tools.move": "Move Topic", - "thread_tools.fork": "Fork Topic", - "thread_tools.delete": "Delete Topic", - "thread_tools.restore": "Restore Topic", + "thread_tools.pin": "Fixar Tópico", + "thread_tools.unpin": "Remover Fixação do Tópico", + "thread_tools.lock": "Trancar Tópico", + "thread_tools.unlock": "Destrancar Tópico", + "thread_tools.move": "Mover Tópico", + "thread_tools.fork": "Fork Tópico", + "thread_tools.delete": "Deletar Tópico", + "thread_tools.restore": "Restaurar Tópico", "load_categories": "Carregando Categorias", "disabled_categories_note": "Categorias desabilitadas estão em cinza", "confirm_move": "Mover", @@ -41,10 +46,10 @@ "favourites.not_logged_in.title": "Não Logado", "favourites.not_logged_in.message": "Por Favor logar para favoritar o tópico", "favourites.has_no_favourites": "Você não tem nenhum item favoritado!", - "vote.not_logged_in.title": "Not Logged In", - "vote.not_logged_in.message": "Please log in in order to vote", - "vote.cant_vote_self.title": "Invalid Vote", - "vote.cant_vote_self.message": "You cannot vote for your own post", + "vote.not_logged_in.title": "Não está logado", + "vote.not_logged_in.message": "Por favor efetuar login para votar", + "vote.cant_vote_self.title": "Voto inválido", + "vote.cant_vote_self.message": "Você não pode votar o seu próprio post", "loading_more_posts": "Carregando mais posts", "move_topic": "Mover Tó;pico", "move_post": "Mover Post", @@ -55,11 +60,14 @@ "fork_success": "Fork realizado com sucesso!", "reputation": "Reputação", "posts": "Posts", - "composer.title_placeholder": "Enter your topic title here...", - "composer.write": "Write", - "composer.preview": "Preview", - "composer.discard": "Discard", - "composer.submit": "Submit", - "composer.replying_to": "Replying to", - "composer.new_topic": "New Topic" + "composer.title_placeholder": "Digite seu tópico aqui...", + "composer.write": "Escreva", + "composer.preview": "Pré Visualização", + "composer.discard": "Descartar", + "composer.submit": "Enviar", + "composer.replying_to": "Respondendo para", + "composer.new_topic": "Novo Tópico", + "composer.drag_and_drop_images": "Clique e arraste imagens aqui", + "composer.content_is_parsed_with": "Conteúdo está separado com", + "composer.upload_instructions": "Mande suas imagens arrastando e soltando." } \ No newline at end of file diff --git a/public/language/pt_BR/user.json b/public/language/pt_BR/user.json index 09270bb6d8..6991971504 100644 --- a/public/language/pt_BR/user.json +++ b/public/language/pt_BR/user.json @@ -9,7 +9,7 @@ "age": "Idade", "joined": "Cadastrou", "lastonline": "Última vez online", - "profile": "Profile", + "profile": "Perfil", "profile_views": "Visualizações de Profile", "reputation": "Reputação", "posts": "Posts", @@ -19,29 +19,29 @@ "signature": "Assinatura", "gravatar": "Gravatar", "birthday": "Aniversário", - "chat": "Chat", - "follow": "Follow", - "unfollow": "Unfollow", + "chat": "Bate Papo", + "follow": "Seguir", + "unfollow": "Deixar de Seguir", "change_picture": "Alterar Foto", "edit": "Editar", "uploaded_picture": "Foto Carregada", "upload_new_picture": "Carregar novo Foto", - "current_password": "Current Password", + "current_password": "Senha Atual", "change_password": "Alterar Senha", "confirm_password": "Confirmar Senha", "password": "Senha", "upload_picture": "Carregar Foto", "upload_a_picture": "Carregar Foto", - "image_spec": "You may only upload PNG, JPG, or GIF files", + "image_spec": "Você pode usar somente arquivos PNG, JPG ou GIF", "max": "max.", "settings": "Configurações", "show_email": "Mostrar meu email", "has_no_follower": "Ninguém está seguindo esse usuário :(", "follows_no_one": "Este usuário não está seguindo ninguém :(", - "has_no_posts": "This user didn't post anything yet.", + "has_no_posts": "Este usuário não postou nada ainda.", "email_hidden": "Email Escondido", "hidden": "Escondido", - "paginate_description": "Paginate topics and posts instead of using infinite scroll.", - "topics_per_page": "Topics per Page", - "posts_per_page": "Posts per Page" + "paginate_description": "Paginação de tópicos e posts ao invés de usar \"scroll infinito\"", + "topics_per_page": "Tópicos por Página", + "posts_per_page": "Posts por Página" } \ No newline at end of file diff --git a/public/language/sk/global.json b/public/language/sk/global.json index 6fa7361dca..cf17eb234d 100644 --- a/public/language/sk/global.json +++ b/public/language/sk/global.json @@ -10,6 +10,8 @@ "500.message": "Jejda, vyzerá, že sa niečo pokazilo.", "register": "Registrovať", "login": "Prihlásiť sa", + "please_log_in": "Prosím Prihláste sa", + "posting_restriction_info": "Prispievanie je obmedzené len pre registrovaných, kliknite pre Prihlásenie sa ", "welcome_back": "Vitaj naspäť", "you_have_successfully_logged_in": "Úspešne si sa prihlásil", "logout": "Odhlásiť sa", diff --git a/public/language/sk/pages.json b/public/language/sk/pages.json index d60e0a0a9b..4fa2659252 100644 --- a/public/language/sk/pages.json +++ b/public/language/sk/pages.json @@ -1,7 +1,7 @@ { "home": "Home", "unread": "Unread Topics", - "popular": "Popular Topics", + "popular": "Populárne Témy", "recent": "Recent Topics", "users": "Registered Users", "notifications": "Notifications", diff --git a/public/language/sk/topic.json b/public/language/sk/topic.json index 4bf7ffe6cd..b7a2bac591 100644 --- a/public/language/sk/topic.json +++ b/public/language/sk/topic.json @@ -20,6 +20,11 @@ "flag": "Označiť", "flag_title": "Označiť príspevok pre moderáciu", "deleted_message": "Toto vlákno bolo vymazané. Iba užívatelia s privilégiami ho môžu vidieť.", + "following_topic.title": "Sledovať Tému", + "following_topic.message": "Budete teraz príjimať notifikácie, ked niekto prispeje do témy.", + "not_following_topic.title": "Nesledujete Tému", + "not_following_topic.message": "Nebudete už dostávať notifikácie z tejto Témy", + "login_to_subscribe": "Prosím Zaregistrujte sa alebo sa Prihláste, aby ste mohli odoberať túto Tému", "watch": "Sledovať", "share_this_post": "Zdielaj tento príspevok", "thread_tools.title": "Nástroje", @@ -61,5 +66,8 @@ "composer.discard": "Zahodiť", "composer.submit": "Poslať", "composer.replying_to": "Odpovedáš ", - "composer.new_topic": "Nová téma" + "composer.new_topic": "Nová téma", + "composer.drag_and_drop_images": "Pretiahni a Pusť Obrázky Sem", + "composer.content_is_parsed_with": "Obsah je vybraný s", + "composer.upload_instructions": "Nahraj obrázky pretiahnutím a pustením ich." } \ No newline at end of file diff --git a/src/plugins.js b/src/plugins.js index 5dad12632a..30731712e8 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -114,20 +114,7 @@ var fs = require('fs'), if (pluginData.minver && semver.validRange(pluginData.minver)) { if (!semver.satisfies(pkg.version, pluginData.minver)) { // If NodeBB is not new enough to run this plugin - if (process.env.NODE_ENV === 'development') { - // Throw a warning in development, but do nothing else - winston.warn('[plugins/' + pluginData.id + '] This plugin may not be compatible with your version of NodeBB. This may cause unintended behaviour or crashing.'); - } else { - if (nconf.get('check-plugins') !== false) { - // Refuse to load this plugin... - winston.error('[plugins/' + pluginData.id + '] This plugin is reportedly incompatible with your version of NodeBB, so it has been disabled.'); - winston.error('[plugins/' + pluginData.id + '] Use `--no-check-plugins` if you wish to live dangerously.'); - - // ... and disable it, too - Plugins.toggleActive(pluginData.id); - return callback(); - } - } + winston.warn('[plugins/' + pluginData.id + '] This plugin may not be compatible with your version of NodeBB. This may cause unintended behaviour or crashing.'); } } diff --git a/src/webserver.js b/src/webserver.js index b7028efc5c..b4d5afe7b6 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -52,7 +52,7 @@ var shutdown = function(code) { db.close(); winston.info('[app] Database connection closed.'); - winston.info('[app] Goodbye!'); + winston.info('[app] Shutdown complete.'); process.exit(); }, restart = function() {