Next
Previous
Contents
Main engine is in masser.fcgi file, which must be installed in such a place
to be accessible by web server. Applications themselves can be placed anywhere,
but I recommend to store them outside of DOCUMENT_ROOT of web server not to
be viewed using web server due to error or bad configuration.
It's fast-cgi application, so main program is started by web server (at start
or at first request - regarding configuration).
Immediately after start program will read configuration:
- if environment variable
MASSER_CONFIG
is set,
configuration file is read from file set in this variable
- otherwise configuration is read from
masser.conf
file
- if this setting is not absolute path, masser is trying to find
the file in these directories:
- current directory
- directory
/usr/etc
- directory
/etc
When a request is received, system processes parameters, first of all from
request URL, then from request itself (GET or POST type).
- after URL part leading to script masser one or two
(or three in debug mode) parts are processed:
- if the first argument is
_source
, program will show
source code of the page
- first part is supposed to be application code
- second part is assumed to be (list of) page(s) requested to be
shown
Examples:
/path_to_masser/masser/TEST
will show (default) page of TEST application
/path_to_masser/masser/_source/TEST/page1
will show source code of page page1 from TEST application
- next following variables are worked out (if they are not set from previous point):
- APP
application name (uppercase is recommended), default
is APP
- PG
list of pages to be shown (comma separated), default is
default
- OP
list of operations to be done (comma separated), default
is none (empty)
- LANG
language code, default is CZ
- SCH
schema code, to be used by application
- SID
Session Identification, to be used by application
Next application is initialized (if not used before):
- read and parse configuration according to masser settings,
filename is assumed to be in this form:
application name converted to lowercase with .conf suffix
- database connect initialization (regarding configuration)
- read and parse files with labels in languages according to
configuration, filenames are assumed in <app>_lang.<lang_code>
form (app always in lowercase) and masser tries to find it for every path from
masser.conf and app.conf this way:
- directory / app_name /
lang
/ file
- directory / app_name / file
- directory /
lang
/ file
- directory / file
- application initialization: masser tries to find file <app>.init
(app converted to lowercase) like this:
- directory / app_name /
init
/ file
- directory / app_name / file
- directory /
init
/ file
- directory / file
If this file is found, it's compiled and run only once (for
every masser instance).
This is not true for debug mode, in this mode init action is run every
request.
This code is intended to actions to be performed only once in
"application life" (for example read some specific configuration,
setting some special database parameters etc.).
Persistent variable %p can be used - read more in some next
chapter.
Then all requested actions and pages will run.
Action or page is processed this way:
- compilation if not compiled yet
always in debug mode
- check or connect required databases
- prepare SQL statements if they are not prepared yet
always in debug mode
- set correct values to %txt hash (according to
LANG variable)
- write source (compiled) code, if write_code_dir is set
- set persistent hash %p values
- run the code
- check pending transactions, write error if there are any and rollback
them (regard pending_transaction_rollback setting)
Next
Previous
Contents