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 ...@@ -3,6 +3,7 @@ webserver=apache
mailserver=postfix mailserver=postfix
dnsserver=mydns dnsserver=mydns
[server] [server]
auto_network_configuration=n auto_network_configuration=n
ip_address=192.168.0.105 ip_address=192.168.0.105
...@@ -10,6 +11,7 @@ netmask=255.255.255.0 ...@@ -10,6 +11,7 @@ netmask=255.255.255.0
gateway=192.168.0.1 gateway=192.168.0.1
hostname=server1.domain.tld hostname=server1.domain.tld
nameservers=192.168.0.1,192.168.0.2 nameservers=192.168.0.1,192.168.0.2
loglevel=2
[mail] [mail]
module=postfix_mysql module=postfix_mysql
......
...@@ -119,6 +119,14 @@ $form["tabs"]['server'] = array ( ...@@ -119,6 +119,14 @@ $form["tabs"]['server'] = array (
'width' => '40', 'width' => '40',
'maxlength' => '255' '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 # ENDE Datatable fields
################################## ##################################
......
...@@ -46,4 +46,5 @@ $wb["wget_txt"] = 'Path to wget program'; ...@@ -46,4 +46,5 @@ $wb["wget_txt"] = 'Path to wget program';
$wb["web_user_txt"] = 'Apache user'; $wb["web_user_txt"] = 'Apache user';
$wb["web_group_txt"] = 'Apache group'; $wb["web_group_txt"] = 'Apache group';
$wb["security_level_txt"] = 'Security level'; $wb["security_level_txt"] = 'Security level';
$wb["loglevel_txt"] = 'Loglevel';
?> ?>
\ No newline at end of file
<h2><tmpl_var name="list_head_txt"></h2> <h2><tmpl_var name="list_head_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p> <p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_server_config"> <div class="panel panel_server_config">
<div class="pnl_formsarea"> <div class="pnl_formsarea">
<fieldset class="inlineLabels"> <fieldset class="inlineLabels">
<div class="ctrlHolder"> <div class="ctrlHolder">
<p class="label">{tmpl_var name='auto_network_configuration_txt'}</p> <p class="label">{tmpl_var name='auto_network_configuration_txt'}</p>
<div class="multiField"> <div class="multiField">
{tmpl_var name='auto_network_configuration'} {tmpl_var name='auto_network_configuration'}
</div> </div>
</div> </div>
<div class="ctrlHolder"> <div class="ctrlHolder">
<label for="ip_address">{tmpl_var name='ip_address_txt'}</label> <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" /> <input name="ip_address" id="ip_address" value="{tmpl_var name='ip_address'}" size="15" maxlength="255" type="text" class="textInput formLengthIPv4" />
</div> </div>
<div class="ctrlHolder"> <div class="ctrlHolder">
<label for="netmask">{tmpl_var name='netmask_txt'}</label> <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" /> <input name="netmask" id="netmask" value="{tmpl_var name='netmask'}" size="15" maxlength="255" type="text" class="textInput formLengthIPv4" />
</div> </div>
<div class="ctrlHolder"> <div class="ctrlHolder">
<label for="gateway">{tmpl_var name='gateway_txt'}</label> <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" /> <input name="gateway" id="gateway" value="{tmpl_var name='gateway'}" size="15" maxlength="255" type="text" class="textInput formLengthIPv4" />
</div> </div>
<div class="ctrlHolder"> <div class="ctrlHolder">
<label for="hostname">{tmpl_var name='hostname_txt'}</label> <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" /> <input name="hostname" id="hostname" value="{tmpl_var name='hostname'}" size="40" maxlength="255" type="text" class="textInput" />
</div> </div>
<div class="ctrlHolder"> <div class="ctrlHolder">
<label for="nameservers">{tmpl_var name='nameservers_txt'}</label> <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" /> <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> <p class="formHint">{tmpl_var name='nameservers_hint_txt'}</p>
</div> </div>
</fieldset> <div class="ctrlHolder">
<label for="loglevel">{tmpl_var name='loglevel_txt'}</label>
<input type="hidden" name="id" value="{tmpl_var name='id'}"> <select name="loglevel" id="loglevel" class="selectInput">
{tmpl_var name='loglevel'}
<div class="buttonHolder buttons"> </select>
<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> </div>
<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> </fieldset>
</div>
</div> <input type="hidden" name="id" value="{tmpl_var name='id'}">
</div> <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) { ...@@ -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 // Check if another process is running
if(is_file($conf["temppath"].$conf["fs_div"].".ispconfig_lock")){ 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 ...@@ -75,10 +88,6 @@ $app->log("Set Lock: ".$conf["temppath"].$conf["fs_div"].".ispconfig_lock", LOGL
if($app->db->connect() && $app->dbmaster->connect()) { 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 // 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_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"]; $tmp_num_records = $tmp_rec["number"];
...@@ -91,9 +100,7 @@ if($app->db->connect() && $app->dbmaster->connect()) { ...@@ -91,9 +100,7 @@ if($app->db->connect() && $app->dbmaster->connect()) {
// Write the Log // Write the Log
$app->log("Found $tmp_num_records changes, starting update process.", LOGLEVEL_DEBUG); $app->log("Found $tmp_num_records changes, starting update process.", LOGLEVEL_DEBUG);
// Load required base-classes // Load required base-classes
$app->uses('ini_parser,modules,plugins,file,services'); $app->uses('modules,plugins,file,services');
// Get server configuration
$conf["serverconfig"] = $app->ini_parser->parse_ini_string(stripslashes($server_db_record["config"]));
// Load the modules that are im the mods-enabled folder // Load the modules that are im the mods-enabled folder
$app->modules->loadModules('all'); $app->modules->loadModules('all');
// Load the plugins that are in the plugins-enabled folder // Load the plugins that are in the plugins-enabled folder
...@@ -110,9 +117,7 @@ if($app->db->connect() && $app->dbmaster->connect()) { ...@@ -110,9 +117,7 @@ if($app->db->connect() && $app->dbmaster->connect()) {
// Write the log // Write the log
$app->log('No Updated records found, starting only the core.', LOGLEVEL_DEBUG); $app->log('No Updated records found, starting only the core.', LOGLEVEL_DEBUG);
// Load required base-classes // Load required base-classes
$app->uses('ini_parser,modules,plugins,file,services'); $app->uses('modules,plugins,file,services');
// Get server configuration
$conf["serverconfig"] = $app->ini_parser->parse_ini_string(stripslashes($server_db_record["config"]));
// Load the modules that are im the mods-core folder // Load the modules that are im the mods-core folder
$app->modules->loadModules('core'); $app->modules->loadModules('core');
// Load the plugins that are in the plugins-core folder // 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