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
......@@ -32,6 +32,12 @@
<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'}">
......
......@@ -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