diff --git a/install/froxlor.sql b/install/froxlor.sql index 73d29d75..d57f5680 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -267,6 +267,8 @@ CREATE TABLE `panel_domains` ( `ocsp_stapling` tinyint(1) DEFAULT '0', `http2` tinyint(1) DEFAULT '0', `notryfiles` tinyint(1) DEFAULT '0', + `writeaccesslog` tinyint(1) DEFAULT '1', + `writeerrorlog` tinyint(1) DEFAULT '1', PRIMARY KEY (`id`), KEY `customerid` (`customerid`), KEY `parentdomain` (`parentdomainid`), @@ -695,7 +697,7 @@ opcache.interned_strings_buffer'), ('panel', 'customer_hide_options', ''), ('panel', 'is_configured', '0'), ('panel', 'version', '0.10.0'), - ('panel', 'db_version', '201812100'); + ('panel', 'db_version', '201812180'); DROP TABLE IF EXISTS `panel_tasks`; diff --git a/install/updates/froxlor/0.10/update_0.10.inc.php b/install/updates/froxlor/0.10/update_0.10.inc.php index 4124a8d2..54288311 100644 --- a/install/updates/froxlor/0.10/update_0.10.inc.php +++ b/install/updates/froxlor/0.10/update_0.10.inc.php @@ -111,8 +111,16 @@ if (isDatabaseVersion('201812010')) { showUpdateStep("Adding new is_configured-flag"); // updated systems are already configured (most likely :P) Settings::AddNew('panel.is_configured', '1', true); - lastStepStatus(0); - updateToDbVersion('201812100'); + updateToDbVersion('201812100'); } +if (isDatabaseVersion('201812100')) { + + showUpdateStep("Adding fields writeaccesslog and writeerrorlog for domains"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `writeaccesslog` tinyint(1) NOT NULL default '1';"); + Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `writeerrorlog` tinyint(1) NOT NULL default '1';"); + lastStepStatus(0); + + updateToDbVersion('201812180'); +} diff --git a/lib/classes/api/commands/class.Domains.php b/lib/classes/api/commands/class.Domains.php index 75669c67..b9a72d65 100644 --- a/lib/classes/api/commands/class.Domains.php +++ b/lib/classes/api/commands/class.Domains.php @@ -145,6 +145,10 @@ class Domains extends ApiCommand implements ResourceEntity * optional, custom webserver vhost-content which is added to the generated vhost, default empty * @param bool $notryfiles * optional, [nginx only] do not generate the default try-files directive, default 0 (false) + * @param bool $writeaccesslog + * optional, Enable writing an access-log file for this domain, default 1 (true) + * @param bool $writeerrorlog + * optional, Enable writing an error-log file for this domain, default 1 (true) * @param string $documentroot * optional, specify homedir of domain by specifying a directory (relative to customer-docroot), be aware, if path starts with / it it considered a full path, not relative to customer-docroot. Also specifying a URL is possible here (redirect), default empty (autogenerated) * @param bool $phpenabled @@ -205,6 +209,8 @@ class Domains extends ApiCommand implements ResourceEntity $dkim = $this->getBoolParam('dkim', true, 0); $specialsettings = $this->getParam('specialsettings', true, ''); $notryfiles = $this->getBoolParam('notryfiles', true, 0); + $writeaccesslog = $this->getBoolParam('writeaccesslog', true, 1); + $writeerrorlog = $this->getBoolParam('writeerrorlog', true, 1); $documentroot = $this->getParam('documentroot', true, ''); $phpenabled = $this->getBoolParam('phpenabled', true, 0); $openbasedir = $this->getBoolParam('openbasedir', true, 0); @@ -316,6 +322,8 @@ class Domains extends ApiCommand implements ResourceEntity $dkim = '0'; $specialsettings = ''; $notryfiles = '0'; + $writeaccesslog = '1'; + $writeerrorlog = '1'; $documentroot = $_documentroot; } @@ -531,6 +539,8 @@ class Domains extends ApiCommand implements ResourceEntity 'speciallogfile' => $speciallogfile, 'specialsettings' => $specialsettings, 'notryfiles' => $notryfiles, + 'writeaccesslog' => $writeaccesslog, + 'writeerrorlog' => $writeerrorlog, 'ssl_redirect' => $ssl_redirect, 'add_date' => time(), 'registration_date' => $registration_date, @@ -571,6 +581,8 @@ class Domains extends ApiCommand implements ResourceEntity `speciallogfile` = :speciallogfile, `specialsettings` = :specialsettings, `notryfiles` = :notryfiles, + `writeaccesslog` = :writeaccesslog, + `writeerrorlog` = :writeerrorlog, `ssl_redirect` = :ssl_redirect, `add_date` = :add_date, `registration_date` = :registration_date, @@ -688,6 +700,10 @@ class Domains extends ApiCommand implements ResourceEntity * optional, whether to apply specialsettings to all subdomains of this domain, default 0 (false) * @param bool $notryfiles * optional, [nginx only] do not generate the default try-files directive, default 0 (false) + * @param bool $writeaccesslog + * optional, Enable writing an access-log file for this domain, default 1 (true) + * @param bool $writeerrorlog + * optional, Enable writing an error-log file for this domain, default 1 (true) * @param string $documentroot * optional, specify homedir of domain by specifying a directory (relative to customer-docroot), be aware, if path starts with / it it considered a full path, not relative to customer-docroot. Also specifying a URL is possible here (redirect), default empty (autogenerated) * @param bool $phpenabled @@ -761,6 +777,8 @@ class Domains extends ApiCommand implements ResourceEntity $specialsettings = $this->getParam('specialsettings', true, $result['specialsettings']); $ssfs = $this->getBoolParam('specialsettingsforsubdomains', true, 0); $notryfiles = $this->getBoolParam('notryfiles', true, $result['notryfiles']); + $writeaccesslog = $this->getBoolParam('writeaccesslog', true, $result['writeaccesslog']); + $writeerrorlog = $this->getBoolParam('writeerrorlog', true, $result['writeerrorlog']); $documentroot = $this->getParam('documentroot', true, $result['documentroot']); $phpenabled = $this->getBoolParam('phpenabled', true, $result['phpenabled']); $phpfs = $this->getBoolParam('phpsettingsforsubdomains', true, 0); @@ -953,6 +971,8 @@ class Domains extends ApiCommand implements ResourceEntity $specialsettings = $result['specialsettings']; $ssfs = (empty($specialsettings) ? 0 : 1); $notryfiles = $result['notryfiles']; + $writeaccesslog = $result['writeaccesslog']; + $writeerrorlog = $result['writeerrorlog']; $documentroot = $result['documentroot']; } @@ -1115,7 +1135,7 @@ class Domains extends ApiCommand implements ResourceEntity $wwwserveralias = ($serveraliasoption == '1') ? '1' : '0'; $iswildcarddomain = ($serveraliasoption == '0') ? '1' : '0'; - if ($documentroot != $result['documentroot'] || $ssl_redirect != $result['ssl_redirect'] || $wwwserveralias != $result['wwwserveralias'] || $iswildcarddomain != $result['iswildcarddomain'] || $phpenabled != $result['phpenabled'] || $openbasedir != $result['openbasedir'] || $phpsettingid != $result['phpsettingid'] || $mod_fcgid_starter != $result['mod_fcgid_starter'] || $mod_fcgid_maxrequests != $result['mod_fcgid_maxrequests'] || $specialsettings != $result['specialsettings'] || $notryfiles != $result['notryfiles'] || $aliasdomain != $result['aliasdomain'] || $issubof != $result['ismainbutsubto'] || $email_only != $result['email_only'] || ($speciallogfile != $result['speciallogfile'] && $speciallogverified == '1') || $letsencrypt != $result['letsencrypt'] || $http2 != $result['http2'] || $hsts_maxage != $result['hsts'] || $hsts_sub != $result['hsts_sub'] || $hsts_preload != $result['hsts_preload'] || $ocsp_stapling != $result['ocsp_stapling']) { + if ($documentroot != $result['documentroot'] || $ssl_redirect != $result['ssl_redirect'] || $wwwserveralias != $result['wwwserveralias'] || $iswildcarddomain != $result['iswildcarddomain'] || $phpenabled != $result['phpenabled'] || $openbasedir != $result['openbasedir'] || $phpsettingid != $result['phpsettingid'] || $mod_fcgid_starter != $result['mod_fcgid_starter'] || $mod_fcgid_maxrequests != $result['mod_fcgid_maxrequests'] || $specialsettings != $result['specialsettings'] || $notryfiles != $result['notryfiles'] || $writeaccesslog != $result['writeaccesslog'] || $writeerrorlog != $result['writeerrorlog'] || $aliasdomain != $result['aliasdomain'] || $issubof != $result['ismainbutsubto'] || $email_only != $result['email_only'] || ($speciallogfile != $result['speciallogfile'] && $speciallogverified == '1') || $letsencrypt != $result['letsencrypt'] || $http2 != $result['http2'] || $hsts_maxage != $result['hsts'] || $hsts_sub != $result['hsts_sub'] || $hsts_preload != $result['hsts_preload'] || $ocsp_stapling != $result['ocsp_stapling']) { inserttask('1'); } @@ -1267,6 +1287,8 @@ class Domains extends ApiCommand implements ResourceEntity $update_data['mod_fcgid_maxrequests'] = $mod_fcgid_maxrequests; $update_data['specialsettings'] = $specialsettings; $update_data['notryfiles'] = $notryfiles; + $update_data['writeaccesslog'] = $writeaccesslog; + $update_data['writeerrorlog'] = $writeerrorlog; $update_data['registration_date'] = $registration_date; $update_data['termination_date'] = $termination_date; $update_data['ismainbutsubto'] = $issubof; @@ -1302,6 +1324,8 @@ class Domains extends ApiCommand implements ResourceEntity `mod_fcgid_maxrequests` = :mod_fcgid_maxrequests, `specialsettings` = :specialsettings, `notryfiles` = :notryfiles, + `writeaccesslog` = :writeaccesslog, + `writeerrorlog` = :writeerrorlog, `registration_date` = :registration_date, `termination_date` = :termination_date, `ismainbutsubto` = :ismainbutsubto, diff --git a/lib/formfields/admin/domains/formfield.domains_add.php b/lib/formfields/admin/domains/formfield.domains_add.php index a18018b7..dfaa8c0d 100644 --- a/lib/formfields/admin/domains/formfield.domains_add.php +++ b/lib/formfields/admin/domains/formfield.domains_add.php @@ -144,6 +144,30 @@ return array( ) ), 'value' => array() + ), + 'writeaccesslog' => array( + 'label' => $lng['admin']['writeaccesslog']['title'], + 'desc' => $lng['admin']['writeaccesslog']['description'], + 'type' => 'checkbox', + 'values' => array( + array( + 'label' => $lng['panel']['yes'], + 'value' => '1' + ) + ), + 'value' => array('1') + ), + 'writeerrorlog' => array( + 'label' => $lng['admin']['writeerrorlog']['title'], + 'desc' => $lng['admin']['writeerrorlog']['description'], + 'type' => 'checkbox', + 'values' => array( + array( + 'label' => $lng['panel']['yes'], + 'value' => '1' + ) + ), + 'value' => array('1') ) ) ), diff --git a/lib/formfields/admin/domains/formfield.domains_edit.php b/lib/formfields/admin/domains/formfield.domains_edit.php index 5e791da7..73f1fdf5 100644 --- a/lib/formfields/admin/domains/formfield.domains_edit.php +++ b/lib/formfields/admin/domains/formfield.domains_edit.php @@ -176,6 +176,30 @@ return array( 'value' => array( $result['notryfiles'] ) + ), + 'writeaccesslog' => array( + 'label' => $lng['admin']['writeaccesslog']['title'], + 'desc' => $lng['admin']['writeaccesslog']['description'], + 'type' => 'checkbox', + 'values' => array( + array( + 'label' => $lng['panel']['yes'], + 'value' => '1' + ) + ), + 'value' => array($result['writeaccesslog']) + ), + 'writeerrorlog' => array( + 'label' => $lng['admin']['writeerrorlog']['title'], + 'desc' => $lng['admin']['writeerrorlog']['description'], + 'type' => 'checkbox', + 'values' => array( + array( + 'label' => $lng['panel']['yes'], + 'value' => '1' + ) + ), + 'value' => array($result['writeerrorlog']) ) ) ), diff --git a/lib/version.inc.php b/lib/version.inc.php index f8234062..d7d2f222 100644 --- a/lib/version.inc.php +++ b/lib/version.inc.php @@ -19,7 +19,7 @@ $version = '0.10.0'; // Database version (YYYYMMDDC where C is a daily counter) -$dbversion = '201812100'; +$dbversion = '201812180'; // Distribution branding-tag (used for Debian etc.) $branding = ''; diff --git a/lng/english.lng.php b/lng/english.lng.php index 18aad6a1..5e41cea4 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1706,6 +1706,10 @@ $lng['error']['setlessthanalreadyused'] = 'You cannot set less resources of \'%s $lng['error']['stringmustntbeempty'] = 'The value for the field %s must not be empty'; $lng['admin']['domain_editable']['title'] = 'Allow editing of domain'; $lng['admin']['domain_editable']['desc'] = 'If set to yes, the customer is allowed to change several domain-settings.
If set to no, nothing can be changed by the customer.'; +$lng['admin']['writeaccesslog']['title'] = 'Write an access log'; +$lng['admin']['writeaccesslog']['description'] = 'Enable this to get an access-log file for this domain'; +$lng['admin']['writeerrorlog']['title'] = 'Write an error log'; +$lng['admin']['writeerrorlog']['description'] = 'Enable this to get an error-log file for this domain'; // Added in Froxlor 0.9.29-dev $lng['serversettings']['panel_phpconfigs_hidestdsubdomain']['title'] = 'Hide standard-subdomains in PHP-configuration overview'; diff --git a/lng/german.lng.php b/lng/german.lng.php index 0cda1bea..7bc11091 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1432,6 +1432,10 @@ $lng['error']['setlessthanalreadyused'] = 'Es können nicht weniger Resourcen vo $lng['error']['stringmustntbeempty'] = 'Der Wert für das Feld "%s" darf nicht leer sein'; $lng['admin']['domain_editable']['title'] = 'Erlaube Bearbeiten der Domain'; $lng['admin']['domain_editable']['desc'] = 'Wenn ja, darf der Kunde verschiedene Einstellungen anpassen.
Wenn nein, darf nichts durch den Kunden geändert werden.'; +$lng['admin']['writeaccesslog']['title'] = 'Zugriffslog schreiben'; +$lng['admin']['writeaccesslog']['description'] = 'Aktiviere diese Option, um für diese Domain eine Access-Log Datei zu erhalten'; +$lng['admin']['writeerrorlog']['title'] = 'Fehlerlog schreiben'; +$lng['admin']['writeerrorlog']['description'] = 'Aktiviere diese Option, um für diese Domain eine Error-Log Datei zu erhalten'; // Added in Froxlor 0.9.29-dev $lng['serversettings']['panel_phpconfigs_hidestdsubdomain']['title'] = 'Verstecke Standard-Subdomains in PHP-Konfigurations-Übersicht'; diff --git a/scripts/jobs/cron_tasks.inc.http.10.apache.php b/scripts/jobs/cron_tasks.inc.http.10.apache.php index 7adfce2f..bcce44d5 100644 --- a/scripts/jobs/cron_tasks.inc.http.10.apache.php +++ b/scripts/jobs/cron_tasks.inc.http.10.apache.php @@ -737,10 +737,27 @@ class apache extends HttpConfigBase $speciallogfile = ''; } - // The normal access/error - logging is enabled - $error_log = makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-error.log'); - $access_log = makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log'); + if ($domain['writeerrorlog']) { + // The normal access/error - logging is enabled + $error_log = makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-error.log'); + // Create the logfile if it does not exist (fixes #46) + touch($error_log); + chown($error_log, Settings::Get('system.httpuser')); + chgrp($error_log, Settings::Get('system.httpgroup')); + } else { + $error_log = '/dev/null'; + } + if ($domain['writeaccesslog']) { + $access_log = makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log'); + // Create the logfile if it does not exist (fixes #46) + touch($access_log); + chown($access_log, Settings::Get('system.httpuser')); + chgrp($access_log, Settings::Get('system.httpgroup')); + } else { + $access_log = '/dev/null'; + } + $logtype = 'combined'; if (Settings::Get('system.logfiles_format') != '') { $logtype = 'frx_custom'; diff --git a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php index 0e361306..36721be5 100644 --- a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php +++ b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php @@ -634,13 +634,15 @@ class lighttpd extends HttpConfigBase // The normal access/error - logging is enabled // error log cannot be set conditionally see // https://redmine.lighttpd.net/issues/665 - $access_log = makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log'); - // Create the logfile if it does not exist (fixes #46) - touch($access_log); - chown($access_log, Settings::Get('system.httpuser')); - chgrp($access_log, Settings::Get('system.httpgroup')); + if ($domain['writeaccesslog']) { + $access_log = makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log'); + // Create the logfile if it does not exist (fixes #46) + touch($access_log); + chown($access_log, Settings::Get('system.httpuser')); + chgrp($access_log, Settings::Get('system.httpgroup')); - $logfiles_text .= ' accesslog.filename = "' . $access_log . '"' . "\n"; + $logfiles_text .= ' accesslog.filename = "' . $access_log . '"' . "\n"; + } if (Settings::Get('system.awstats_enabled') == '1') { diff --git a/scripts/jobs/cron_tasks.inc.http.30.nginx.php b/scripts/jobs/cron_tasks.inc.http.30.nginx.php index 6aaf4850..694af5d9 100644 --- a/scripts/jobs/cron_tasks.inc.http.30.nginx.php +++ b/scripts/jobs/cron_tasks.inc.http.30.nginx.php @@ -1024,18 +1024,26 @@ class nginx extends HttpConfigBase } } - // The normal access/error - logging is enabled - $error_log = makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-error.log'); - // Create the logfile if it does not exist (fixes #46) - touch($error_log); - chown($error_log, Settings::Get('system.httpuser')); - chgrp($error_log, Settings::Get('system.httpgroup')); + if ($domain['writeerrorlog']) { + // The normal access/error - logging is enabled + $error_log = makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-error.log'); + // Create the logfile if it does not exist (fixes #46) + touch($error_log); + chown($error_log, Settings::Get('system.httpuser')); + chgrp($error_log, Settings::Get('system.httpgroup')); + } else { + $error_log = '/dev/null'; + } - $access_log = makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log'); - // Create the logfile if it does not exist (fixes #46) - touch($access_log); - chown($access_log, Settings::Get('system.httpuser')); - chgrp($access_log, Settings::Get('system.httpgroup')); + if ($domain['writeaccesslog']) { + $access_log = makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log'); + // Create the logfile if it does not exist (fixes #46) + touch($access_log); + chown($access_log, Settings::Get('system.httpuser')); + chgrp($access_log, Settings::Get('system.httpgroup')); + } else { + $access_log = '/dev/null'; + } $logtype = 'combined'; if (Settings::Get('system.logfiles_format') != '') {