Commit db0a6f29 authored by tbrehm's avatar tbrehm

Implemented: FS#872 - Make loglevel configurable from server settings

parent 97681579
......@@ -3,6 +3,7 @@ webserver=apache
mailserver=postfix
dnsserver=mydns
[server]
auto_network_configuration=n
ip_address=192.168.0.105
......@@ -10,6 +11,7 @@ netmask=255.255.255.0
gateway=192.168.0.1
hostname=server1.domain.tld
nameservers=192.168.0.1,192.168.0.2
loglevel=2
[mail]
module=postfix_mysql
......
......@@ -119,6 +119,14 @@ $form["tabs"]['server'] = array (
'width' => '40',
'maxlength' => '255'
),
'loglevel' => array (
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
'default' => '2',
'value' => array('0' => 'Debug', '1' => 'Warnings', '2' => 'Errors'),
'width' => '40',
'maxlength' => '255'
),
##################################
# ENDE Datatable fields
##################################
......
......@@ -46,4 +46,5 @@ $wb["wget_txt"] = 'Path to wget program';
$wb["web_user_txt"] = 'Apache user';
$wb["web_group_txt"] = 'Apache group';
$wb["security_level_txt"] = 'Security level';
$wb["loglevel_txt"] = 'Loglevel';
?>
\ No newline at end of file
<h2><tmpl_var name="list_head_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_server_config">
<div class="pnl_formsarea">
<fieldset class="inlineLabels">
<div class="ctrlHolder">
<p class="label">{tmpl_var name='auto_network_configuration_txt'}</p>
<div class="multiField">
{tmpl_var name='auto_network_configuration'}
</div>
</div>
<div class="ctrlHolder">
<label for="ip_address">{tmpl_var name='ip_address_txt'}</label>
<input name="ip_address" id="ip_address" value="{tmpl_var name='ip_address'}" size="15" maxlength="255" type="text" class="textInput formLengthIPv4" />
</div>
<div class="ctrlHolder">
<label for="netmask">{tmpl_var name='netmask_txt'}</label>
<input name="netmask" id="netmask" value="{tmpl_var name='netmask'}" size="15" maxlength="255" type="text" class="textInput formLengthIPv4" />
</div>
<div class="ctrlHolder">
<label for="gateway">{tmpl_var name='gateway_txt'}</label>
<input name="gateway" id="gateway" value="{tmpl_var name='gateway'}" size="15" maxlength="255" type="text" class="textInput formLengthIPv4" />
</div>
<div class="ctrlHolder">
<label for="hostname">{tmpl_var name='hostname_txt'}</label>
<input name="hostname" id="hostname" value="{tmpl_var name='hostname'}" size="40" maxlength="255" type="text" class="textInput" />
</div>
<div class="ctrlHolder">
<label for="nameservers">{tmpl_var name='nameservers_txt'}</label>
<input name="nameservers" id="nameservers" value="{tmpl_var name='nameservers'}" size="40" maxlength="255" type="text" class="textInput" />
<p class="formHint">{tmpl_var name='nameservers_hint_txt'}</p>
</div>
</fieldset>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
<div class="buttonHolder buttons">
<button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','admin/server_config_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
<button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('admin/server_config_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
</div>
</div>
</div>
<h2><tmpl_var name="list_head_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_server_config">
<div class="pnl_formsarea">
<fieldset class="inlineLabels">
<div class="ctrlHolder">
<p class="label">{tmpl_var name='auto_network_configuration_txt'}</p>
<div class="multiField">
{tmpl_var name='auto_network_configuration'}
</div>
</div>
<div class="ctrlHolder">
<label for="ip_address">{tmpl_var name='ip_address_txt'}</label>
<input name="ip_address" id="ip_address" value="{tmpl_var name='ip_address'}" size="15" maxlength="255" type="text" class="textInput formLengthIPv4" />
</div>
<div class="ctrlHolder">
<label for="netmask">{tmpl_var name='netmask_txt'}</label>
<input name="netmask" id="netmask" value="{tmpl_var name='netmask'}" size="15" maxlength="255" type="text" class="textInput formLengthIPv4" />
</div>
<div class="ctrlHolder">
<label for="gateway">{tmpl_var name='gateway_txt'}</label>
<input name="gateway" id="gateway" value="{tmpl_var name='gateway'}" size="15" maxlength="255" type="text" class="textInput formLengthIPv4" />
</div>
<div class="ctrlHolder">
<label for="hostname">{tmpl_var name='hostname_txt'}</label>
<input name="hostname" id="hostname" value="{tmpl_var name='hostname'}" size="40" maxlength="255" type="text" class="textInput" />
</div>
<div class="ctrlHolder">
<label for="nameservers">{tmpl_var name='nameservers_txt'}</label>
<input name="nameservers" id="nameservers" value="{tmpl_var name='nameservers'}" size="40" maxlength="255" type="text" class="textInput" />
<p class="formHint">{tmpl_var name='nameservers_hint_txt'}</p>
</div>
<div class="ctrlHolder">
<label for="loglevel">{tmpl_var name='loglevel_txt'}</label>
<select name="loglevel" id="loglevel" class="selectInput">
{tmpl_var name='loglevel'}
</select>
</div>
</fieldset>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
<div class="buttonHolder buttons">
<button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','admin/server_config_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
<button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('admin/server_config_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
</div>
</div>
</div>
......@@ -50,6 +50,19 @@ if($server_db_record == false) {
}
*/
//* Load the server configuration
if($app->dbmaster->connect()) {
// get the dalaog_id of the last performed record
$server_db_record = $app->dbmaster->queryOneRecord("SELECT updated, config FROM server WHERE server_id = ".$conf["server_id"]);
$conf['last_datalog_id'] = (int)$server_db_record['updated'];
// Load the ini_parser
$app->uses('ini_parser');
// Get server configuration
$conf["serverconfig"] = $app->ini_parser->parse_ini_string(stripslashes($server_db_record["config"]));
// Set the loglevel
$conf["log_priority"] = intval($conf["serverconfig"]["server"]["loglevel"]);
}
// Check if another process is running
if(is_file($conf["temppath"].$conf["fs_div"].".ispconfig_lock")){
......@@ -75,10 +88,6 @@ $app->log("Set Lock: ".$conf["temppath"].$conf["fs_div"].".ispconfig_lock", LOGL
if($app->db->connect() && $app->dbmaster->connect()) {
// get the dalaog_id of the last performed record
$server_db_record = $app->dbmaster->queryOneRecord("SELECT updated, config FROM server WHERE server_id = ".$conf["server_id"]);
$conf['last_datalog_id'] = (int)$server_db_record['updated'];
// Check if there is anything to update
$tmp_rec = $app->dbmaster->queryOneRecord("SELECT count(server_id) as number from sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf["server_id"]." OR server_id = 0)");
$tmp_num_records = $tmp_rec["number"];
......@@ -91,9 +100,7 @@ if($app->db->connect() && $app->dbmaster->connect()) {
// Write the Log
$app->log("Found $tmp_num_records changes, starting update process.", LOGLEVEL_DEBUG);
// Load required base-classes
$app->uses('ini_parser,modules,plugins,file,services');
// Get server configuration
$conf["serverconfig"] = $app->ini_parser->parse_ini_string(stripslashes($server_db_record["config"]));
$app->uses('modules,plugins,file,services');
// Load the modules that are im the mods-enabled folder
$app->modules->loadModules('all');
// Load the plugins that are in the plugins-enabled folder
......@@ -110,9 +117,7 @@ if($app->db->connect() && $app->dbmaster->connect()) {
// Write the log
$app->log('No Updated records found, starting only the core.', LOGLEVEL_DEBUG);
// Load required base-classes
$app->uses('ini_parser,modules,plugins,file,services');
// Get server configuration
$conf["serverconfig"] = $app->ini_parser->parse_ini_string(stripslashes($server_db_record["config"]));
$app->uses('modules,plugins,file,services');
// Load the modules that are im the mods-core folder
$app->modules->loadModules('core');
// Load the plugins that are in the plugins-core folder
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment