added: "server_mode" config option (std::wstring)

you can assign any string to it such as "production" "dev"
       this value is not used by winix itself
       you can refer to it from [server_mode] and [server_mode_is] ezc functions





git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1007 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2015-04-16 14:43:52 +00:00
parent ae2a885d6c
commit 5274e8e8ff
8 changed files with 166 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2014, Tomasz Sowa
* Copyright (c) 2008-2015, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -124,6 +124,7 @@ bool Config::ReadConfig(bool errors_to_stdout_, bool stdout_is_closed)
void Config::AssignValues(bool stdout_is_closed)
{
server_mode = Text(L"server_mode");
demonize = Bool(L"demonize", true);
user = Text(L"user");

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2014, Tomasz Sowa
* Copyright (c) 2008-2015, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -55,6 +55,13 @@ public:
// this is the parameter passed to winix programm
std::wstring config_file;
// server mode
// you can assign any string to it such as "production" "dev"
// this value is not used by winix itself
// you can refer to it from [server_mode] and [server_mode_is] ezc functions
std::wstring server_mode;
// start as a demon (in the background)
// default: true
bool demonize;

View File

@ -1339,6 +1339,80 @@ rebus.o: ../../winix/core/sessioncontainer.h
rebus.o: ../../winix/core/ipbancontainer.h ../../winix/core/system.h
rebus.o: ../../winix/core/sessionidmanager.h ../../tito/src/base64.h
rebus.o: ../../tito/src/aes.h ../../winix/core/htmlfilter.h
server.o: templates.h ../../ezc/src/ezc.h ../../ezc/src/generator.h
server.o: ../../ezc/src/blocks.h ../../ezc/src/item.h ../../ezc/src/funinfo.h
server.o: ../../ezc/src/functions.h ../../pikotools/utf8/utf8.h
server.o: ../../ezc/src/cache.h ../../ezc/src/pattern.h
server.o: ../../ezc/src/patternparser.h misc.h localefilter.h locale.h
server.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
server.o: ../../pikotools/textstream/types.h
server.o: ../../pikotools/textstream/textstream.h
server.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
server.o: ../../pikotools/convert/convert.h
server.o: ../../pikotools/convert/inttostr.h
server.o: ../../pikotools/membuffer/membuffer.h
server.o: ../../pikotools/textstream/types.h htmltextstream.h
server.o: ../../winix/core/textstream.h patterncacher.h
server.o: ../../winix/core/item.h indexpatterns.h patterns.h changepatterns.h
server.o: ../../winix/core/config.h ../../winix/core/htmlfilter.h
server.o: ../../winix/core/cur.h ../../winix/core/request.h
server.o: ../../winix/core/requesttypes.h ../../winix/core/error.h
server.o: ../../winix/core/config.h ../../winix/core/textstream.h
server.o: ../../winix/templates/htmltextstream.h
server.o: ../../pikotools/space/spacetojson.h ../../winix/core/session.h
server.o: ../../winix/core/user.h ../../winix/core/plugindata.h
server.o: ../../winix/core/rebus.h ../../winix/core/ipban.h
server.o: ../../winix/core/mount.h ../../winix/core/system.h
server.o: ../../winix/core/job.h ../../winix/core/basethread.h
server.o: ../../winix/core/synchro.h ../../winix/core/dirs.h
server.o: ../../winix/core/dircontainer.h ../../winix/db/db.h
server.o: ../../winix/db/dbbase.h ../../winix/db/dbconn.h
server.o: ../../winix/db/dbtextstream.h ../../winix/core/error.h
server.o: ../../winix/db/dbitemquery.h ../../winix/db/dbitemcolumns.h
server.o: ../../winix/core/user.h ../../winix/core/group.h
server.o: ../../winix/core/dircontainer.h ../../winix/core/ugcontainer.h
server.o: ../../winix/core/log.h ../../winix/core/logmanipulators.h
server.o: ../../winix/core/slog.h ../../winix/core/cur.h
server.o: ../../winix/templates/locale.h ../../winix/notify/notify.h
server.o: ../../winix/notify/notifypool.h ../../winix/templates/patterns.h
server.o: ../../winix/notify/notifythread.h ../../winix/core/basethread.h
server.o: ../../winix/notify/templatesnotify.h ../../winix/core/users.h
server.o: ../../winix/core/ugcontainer.h ../../winix/core/lastcontainer.h
server.o: ../../winix/core/mounts.h ../../winix/core/mountparser.h
server.o: ../../winix/core/crypt.h ../../winix/core/run.h
server.o: ../../winix/core/users.h ../../winix/core/groups.h
server.o: ../../winix/core/group.h ../../winix/core/loadavg.h
server.o: ../../winix/core/image.h ../../winix/core/threadmanager.h
server.o: ../../winix/core/timezones.h ../../winix/core/timezone.h
server.o: ../../winix/core/sessionmanager.h
server.o: ../../winix/core/sessioncontainer.h
server.o: ../../winix/core/ipbancontainer.h ../../winix/core/system.h
server.o: ../../winix/core/sessionidmanager.h ../../tito/src/base64.h
server.o: ../../tito/src/aes.h ../../winix/core/htmlfilter.h
server.o: ../../winix/functions/functions.h
server.o: ../../winix/functions/functionbase.h ../../winix/core/request.h
server.o: ../../winix/core/synchro.h ../../winix/functions/functionparser.h
server.o: ../../winix/functions/account.h ../../winix/functions/adduser.h
server.o: ../../winix/functions/cat.h ../../winix/functions/chmod.h
server.o: ../../winix/functions/privchanger.h ../../winix/functions/chown.h
server.o: ../../winix/functions/ckeditor.h ../../winix/functions/cp.h
server.o: ../../winix/functions/default.h ../../winix/functions/download.h
server.o: ../../winix/functions/emacs.h ../../winix/functions/env.h
server.o: ../../winix/functions/imgcrop.h ../../winix/functions/last.h
server.o: ../../winix/functions/login.h ../../winix/functions/logout.h
server.o: ../../winix/functions/ln.h ../../winix/functions/ls.h
server.o: ../../winix/functions/man.h ../../winix/functions/meta.h
server.o: ../../winix/functions/mkdir.h ../../winix/functions/mv.h
server.o: ../../winix/functions/nicedit.h ../../winix/functions/node.h
server.o: ../../winix/functions/passwd.h ../../winix/functions/priv.h
server.o: ../../winix/functions/pw.h ../../winix/functions/reload.h
server.o: ../../winix/functions/rm.h ../../winix/functions/rmuser.h
server.o: ../../winix/functions/sort.h ../../winix/functions/specialdefault.h
server.o: ../../winix/functions/stat.h ../../winix/functions/subject.h
server.o: ../../winix/functions/template.h ../../winix/functions/tinymce.h
server.o: ../../winix/functions/uname.h ../../winix/functions/upload.h
server.o: ../../winix/functions/uptime.h ../../winix/functions/who.h
server.o: ../../winix/functions/vim.h
slog.o: ../../winix/core/slog.h ../../winix/core/cur.h
slog.o: ../../winix/core/logmanipulators.h ../../winix/templates/locale.h
slog.o: ../../pikotools/textstream/textstream.h ../../pikotools/space/space.h

View File

@ -1 +1 @@
o = adduser.o changepatterns.o config.o currentdate.o dir.o doc.o env.o filters.o generic.o htmltextstream.o indexpatterns.o insert.o ipban.o item.o last.o locale.o localefilter.o login.o ls.o man.o misc.o miscspace.o mount.o passwd.o patterncacher.o patterns.o priv.o rebus.o slog.o stat.o sys.o template.o templates.o textextstream.o upload.o uptime.o user.o who.o winix.o
o = adduser.o changepatterns.o config.o currentdate.o dir.o doc.o env.o filters.o generic.o htmltextstream.o indexpatterns.o insert.o ipban.o item.o last.o locale.o localefilter.o login.o ls.o man.o misc.o miscspace.o mount.o passwd.o patterncacher.o patterns.o priv.o rebus.o server.o slog.o stat.o sys.o template.o templates.o textextstream.o upload.o uptime.o user.o who.o winix.o

66
templates/server.cpp Normal file
View File

@ -0,0 +1,66 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2015, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "templates.h"
#include "functions/functions.h"
namespace Winix
{
namespace TemplatesFunctions
{
void server_mode(Info & i)
{
i.out << config->server_mode;
}
void server_mode_is(Info & i)
{
i.res = (i.par == config->server_mode);
}
} // namespace TemplatesFunctions
} // namespace Winix

View File

@ -578,6 +578,13 @@ void Templates::CreateFunctions()
ezc_functions.Insert("rebus_question", rebus_question);
/*
server
*/
ezc_functions.Insert("server_mode", server_mode);
ezc_functions.Insert("server_mode_is", server_mode_is);
/*
slog
*/

View File

@ -494,6 +494,13 @@ namespace TemplatesFunctions
void rebus_question(Info & i);
/*
server
*/
void server_mode(Info & i);
void server_mode_is(Info & i);
/*
slog
*/