Compare commits

...

20 Commits

Author SHA1 Message Date
Michael Kaufmann
8d6275e1aa set version to 0.10.12 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-10 17:41:20 +01:00
Michael Kaufmann
f21d4f8770 when not using awstats, disable awstats-related settings; add minor tweaks to unit-tests
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-10 16:44:13 +01:00
Michael Kaufmann
fc97b4d4e9 Merge pull request #786 from patschi/logformat-awstats
Allow configuring awstats LogFormat
2020-01-10 16:32:33 +01:00
Patrik Kernstock
05051309c7 Merge branch 'master' into logformat-awstats 2020-01-09 23:24:26 +00:00
Patrik Kernstock
0f025a6627 Language file update
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2020-01-09 23:21:11 +00:00
Michael Kaufmann
f6f5765b54 avoid settig more than one catchall address for one domain in Emails.update(), thx to mrairstone
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-09 14:45:51 +01:00
Michael Kaufmann
ac82aa80d2 correct logfiles_format migration; only needed if setting is non-empty
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-09 14:14:04 +01:00
Michael Kaufmann
57503d9c6e try to touch logfile from settings in order for is_writable to work correctly, thx to rubberduck
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-09 14:10:50 +01:00
Michael Kaufmann
f55ad16d82 Merge pull request #785 from patschi/logformat
Allow using more advanced webserver LogFormat
2020-01-09 09:16:03 +01:00
Patrik Kernstock
ea7834c1d1 Added small notice to lng for awstats LogFormat
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2020-01-08 22:08:15 +00:00
Patrik Kernstock
b355711de9 Improvements as suggested by @d00p
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2020-01-08 22:08:15 +00:00
Michael Kaufmann
a5287726a4 fix issue in PhpHelper::trimArray() returning an empty array, fixes #751
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-03 23:32:21 +01:00
Patrik Kernstock
b393c7d6e6 Merge branch 'master' into logformat 2020-01-03 22:32:45 +01:00
Patrik Kernstock
09aed61dbf Merge branch 'master' into logformat-awstats 2020-01-02 12:44:35 +01:00
Patrik Kernstock
ca39501530 Fixed awstats_logformat field for new installs
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2020-01-02 12:39:25 +01:00
Patrik Kernstock
28fd88e53e Merge branch 'master' into logformat 2020-01-02 12:31:51 +01:00
Patrik Kernstock
a4d4e16efc Small comment added to escaping double-quote
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2019-12-31 22:46:03 +01:00
Patrik Kernstock
7f83ad31f4 Fixed dbversion in SQL/Froxlor.php
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2019-12-31 22:30:54 +01:00
Patrik Kernstock
e143ba4577 Allow configuring awstats LogFormat
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2019-12-31 22:29:29 +01:00
Patrik Kernstock
6799a56ba1 Allow using more advanced LogFormat
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2019-12-31 20:18:52 +01:00
18 changed files with 139 additions and 35 deletions

View File

@@ -173,7 +173,8 @@ return array(
'websrv_avail' => array( 'websrv_avail' => array(
'apache2', 'apache2',
'nginx' 'nginx'
) ),
'visible' => \Froxlor\Settings::Get('system.awstats_enabled') == 1
), ),
'system_logfiles_type' => array( 'system_logfiles_type' => array(
'label' => $lng['serversettings']['logfiles_type'], 'label' => $lng['serversettings']['logfiles_type'],

View File

@@ -33,7 +33,8 @@ return array(
1 => $lng['admin']['webalizer']['quiet'], 1 => $lng['admin']['webalizer']['quiet'],
2 => $lng['admin']['webalizer']['veryquiet'] 2 => $lng['admin']['webalizer']['veryquiet']
), ),
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.awstats_enabled') == 0
), ),
'system_awstats_enabled' => array( 'system_awstats_enabled' => array(
'label' => $lng['serversettings']['awstats_enabled'], 'label' => $lng['serversettings']['awstats_enabled'],
@@ -50,7 +51,8 @@ return array(
'type' => 'string', 'type' => 'string',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/usr/bin/', 'default' => '/usr/bin/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.awstats_enabled') == 1
), ),
'system_awstats_awstatspath' => array( 'system_awstats_awstatspath' => array(
'label' => $lng['serversettings']['awstats_awstatspath'], 'label' => $lng['serversettings']['awstats_awstatspath'],
@@ -59,7 +61,8 @@ return array(
'type' => 'string', 'type' => 'string',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/usr/bin/', 'default' => '/usr/bin/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.awstats_enabled') == 1
), ),
'system_awstats_conf' => array( 'system_awstats_conf' => array(
'label' => $lng['serversettings']['awstats_conf'], 'label' => $lng['serversettings']['awstats_conf'],
@@ -68,7 +71,8 @@ return array(
'type' => 'string', 'type' => 'string',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/etc/awstats/', 'default' => '/etc/awstats/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.awstats_enabled') == 1
), ),
'system_awstats_icons' => array( 'system_awstats_icons' => array(
'label' => $lng['serversettings']['awstats_icons'], 'label' => $lng['serversettings']['awstats_icons'],
@@ -77,7 +81,17 @@ return array(
'type' => 'string', 'type' => 'string',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/usr/share/awstats/icon/', 'default' => '/usr/share/awstats/icon/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.awstats_enabled') == 1
),
'system_awstats_logformat' => array(
'label' => $lng['serversettings']['awstats']['logformat'],
'settinggroup' => 'system',
'varname' => 'awstats_logformat',
'type' => 'string',
'default' => '1',
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.awstats_enabled') == 1
) )
) )
) )

View File

@@ -572,6 +572,7 @@ opcache.interned_strings_buffer'),
('system', 'stdsubdomain', ''), ('system', 'stdsubdomain', ''),
('system', 'awstats_path', '/usr/bin/'), ('system', 'awstats_path', '/usr/bin/'),
('system', 'awstats_conf', '/etc/awstats/'), ('system', 'awstats_conf', '/etc/awstats/'),
('system', 'awstats_logformat', '1'),
('system', 'defaultttl', '604800'), ('system', 'defaultttl', '604800'),
('system', 'mod_fcgid_defaultini', '1'), ('system', 'mod_fcgid_defaultini', '1'),
('system', 'ftpserver', 'proftpd'), ('system', 'ftpserver', 'proftpd'),
@@ -702,8 +703,8 @@ opcache.interned_strings_buffer'),
('panel', 'password_special_char', '!?<>§$%+#=@'), ('panel', 'password_special_char', '!?<>§$%+#=@'),
('panel', 'customer_hide_options', ''), ('panel', 'customer_hide_options', ''),
('panel', 'is_configured', '0'), ('panel', 'is_configured', '0'),
('panel', 'version', '0.10.11'), ('panel', 'version', '0.10.12'),
('panel', 'db_version', '201912311'); ('panel', 'db_version', '201912313');
DROP TABLE IF EXISTS `panel_tasks`; DROP TABLE IF EXISTS `panel_tasks`;

View File

@@ -539,6 +539,30 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201912310')) {
} }
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.10')) { if (\Froxlor\Froxlor::isFroxlorVersion('0.10.10')) {
showUpdateStep("Updating from 0.10.10 to 0.10.11", false); showUpdateStep("Updating from 0.10.10 to 0.10.11", false);
\Froxlor\Froxlor::updateToVersion('0.10.11'); \Froxlor\Froxlor::updateToVersion('0.10.11');
}
if (\Froxlor\Froxlor::isDatabaseVersion('201912311')) {
showUpdateStep("Migrate logfiles_format setting");
$current_format = Settings::Set('system.logfiles_format');
if (!empty($current_format)) {
Settings::Set('system.logfiles_format', '"' . Settings::Get('system.logfiles_format') . '"');
lastStepStatus(0);
} else {
lastStepStatus(0, 'not needed');
}
\Froxlor\Froxlor::updateToDbVersion('201912312');
}
if (\Froxlor\Froxlor::isDatabaseVersion('201912312')) {
showUpdateStep("Adding option change awstats LogFormat");
Settings::AddNew("system.awstats_logformat", '1');
lastStepStatus(0);
\Froxlor\Froxlor::updateToDbVersion('201912313');
}
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.11')) {
showUpdateStep("Updating from 0.10.11 to 0.10.12", false);
\Froxlor\Froxlor::updateToVersion('0.10.12');
} }

View File

@@ -106,10 +106,12 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
); );
$email_check = Database::pexecute_first($stmt, $params, true, true); $email_check = Database::pexecute_first($stmt, $params, true, true);
if (strtolower($email_check['email_full']) == strtolower($email_full)) { if ($email_check) {
\Froxlor\UI\Response::standard_error('emailexistalready', $email_full, true); if (strtolower($email_check['email_full']) == strtolower($email_full)) {
} elseif ($email_check['email'] == $email) { \Froxlor\UI\Response::standard_error('emailexistalready', $email_full, true);
\Froxlor\UI\Response::standard_error('youhavealreadyacatchallforthisdomain', '', true); } elseif ($email_check['email'] == $email) {
\Froxlor\UI\Response::standard_error('youhavealreadyacatchallforthisdomain', '', true);
}
} }
$stmt = Database::prepare(" $stmt = Database::prepare("
@@ -233,6 +235,19 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
$iscatchall = '1'; $iscatchall = '1';
$email_parts = explode('@', $result['email_full']); $email_parts = explode('@', $result['email_full']);
$email = '@' . $email_parts[1]; $email = '@' . $email_parts[1];
// catchall check
$stmt = Database::prepare("
SELECT `email_full` FROM `" . TABLE_MAIL_VIRTUAL . "`
WHERE `email` = :email AND `customerid` = :cid AND `iscatchall` = '1'
");
$params = array(
"email" => $email,
"cid" => $customer['customerid']
);
$email_check = Database::pexecute_first($stmt, $params, true, true);
if ($email_check) {
\Froxlor\UI\Response::standard_error('youhavealreadyacatchallforthisdomain', '', true);
}
} else { } else {
$iscatchall = '0'; $iscatchall = '0';
$email = $result['email_full']; $email = $result['email_full'];
@@ -273,7 +288,7 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
* optional specify offset for resultset * optional specify offset for resultset
* @param array $sql_orderby * @param array $sql_orderby
* optional array with index = fieldname and value = ASC|DESC to order the resultset by one or more fields * optional array with index = fieldname and value = ASC|DESC to order the resultset by one or more fields
* *
* @access admin, customer * @access admin, customer
* @throws \Exception * @throws \Exception
* @return string json-encoded array count|list * @return string json-encoded array count|list

View File

@@ -760,7 +760,7 @@ class Apache extends HttpConfigBase
$logtype = 'combined'; $logtype = 'combined';
if (Settings::Get('system.logfiles_format') != '') { if (Settings::Get('system.logfiles_format') != '') {
$logtype = 'frx_custom'; $logtype = 'frx_custom';
$logfiles_text .= ' LogFormat "' . Settings::Get('system.logfiles_format') . '" ' . $logtype . "\n"; $logfiles_text .= ' LogFormat ' . Settings::Get('system.logfiles_format') . ' ' . $logtype . "\n";
} }
if (Settings::Get('system.logfiles_type') == '2' && Settings::Get('system.logfiles_format') == '') { if (Settings::Get('system.logfiles_type') == '2' && Settings::Get('system.logfiles_format') == '') {
$logtype = 'vhost_combined'; $logtype = 'vhost_combined';

View File

@@ -71,7 +71,7 @@ class Nginx extends HttpConfigBase
} }
$logtype = 'frx_custom'; $logtype = 'frx_custom';
$this->nginx_data[$vhosts_filename] = 'log_format ' . $logtype . ' "' . Settings::Get('system.logfiles_format') . '";' . "\n"; $this->nginx_data[$vhosts_filename] = 'log_format ' . $logtype . ' ' . Settings::Get('system.logfiles_format') . ';' . "\n";
} }
} }

View File

@@ -7,10 +7,10 @@ final class Froxlor
{ {
// Main version variable // Main version variable
const VERSION = '0.10.11'; const VERSION = '0.10.12';
// Database version (YYYYMMDDC where C is a daily counter) // Database version (YYYYMMDDC where C is a daily counter)
const DBVERSION = '201912311'; const DBVERSION = '201912313';
// Distribution branding-tag (used for Debian etc.) // Distribution branding-tag (used for Debian etc.)
const BRANDING = ''; const BRANDING = '';

View File

@@ -87,10 +87,13 @@ class FroxlorLogger
self::$ml->pushHandler(new SyslogHandler('froxlor', LOG_USER, Logger::DEBUG)); self::$ml->pushHandler(new SyslogHandler('froxlor', LOG_USER, Logger::DEBUG));
break; break;
case 'file': case 'file':
if (empty(Settings::Get('logger.logfile')) || ! is_writeable(Settings::Get('logger.logfile'))) { $logger_logfile = Settings::Get('logger.logfile');
// is_writable needs an existing file to check if it's actually writable
@touch($logger_logfile);
if (empty($logger_logfile) || ! is_writable($logger_logfile)) {
Settings::Set('logger.logfile', '/tmp/froxlor.log'); Settings::Set('logger.logfile', '/tmp/froxlor.log');
} }
self::$ml->pushHandler(new StreamHandler(Settings::Get('logger.logfile'), Logger::DEBUG)); self::$ml->pushHandler(new StreamHandler($logger_logfile, Logger::DEBUG));
break; break;
case 'mysql': case 'mysql':
self::$ml->pushHandler(new MysqlHandler(Logger::DEBUG)); self::$ml->pushHandler(new MysqlHandler(Logger::DEBUG));

View File

@@ -37,20 +37,31 @@ class Statistics
\Froxlor\FileDir::safe_exec('mkdir -p ' . escapeshellarg(Settings::Get('system.awstats_conf'))); \Froxlor\FileDir::safe_exec('mkdir -p ' . escapeshellarg(Settings::Get('system.awstats_conf')));
} }
$logformat = Settings::Get('system.awstats_logformat');
if (! is_numeric($logformat)) {
// if LogFormat is NOT numeric (e.g. 1,2,3,4), we quote it.
// 1-4 are pre-defined formats by awstats which must not be quoted to work properly. So if
// it is not a integer, it is something customized and we simply quote it.
// Only escaping double-quote should be fine, as we only put the whole string under double-quote.
$logformat = '"' . str_replace('"', '\"', Settings::Get('system.awstats_logformat')) . '"';
}
// These are the variables we will replace // These are the variables we will replace
$regex = array( $regex = array(
'/\{LOG_FILE\}/', '/\{LOG_FILE\}/',
'/\{SITE_DOMAIN\}/', '/\{SITE_DOMAIN\}/',
'/\{HOST_ALIASES\}/', '/\{HOST_ALIASES\}/',
'/\{CUSTOMER_DOCROOT\}/', '/\{CUSTOMER_DOCROOT\}/',
'/\{AWSTATS_CONF\}/' '/\{AWSTATS_CONF\}/',
'/\{AWSTATS_LOGFORMAT\}/'
); );
$replace = array( $replace = array(
\Froxlor\FileDir::makeCorrectFile($logFile), \Froxlor\FileDir::makeCorrectFile($logFile),
$siteDomain, $siteDomain,
$hostAliases, $hostAliases,
$awstats_dir, $awstats_dir,
\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.awstats_conf')) \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.awstats_conf')),
$logformat
); );
// File names // File names

View File

@@ -374,7 +374,7 @@ class PhpHelper
$returnval = array(); $returnval = array();
if (is_array($source)) { if (is_array($source)) {
$source = array_map('trim', $source); $source = array_map('trim', $source);
$source = array_filter($source, function ($value) { $returnval = array_filter($source, function ($value) {
return $value !== ''; return $value !== '';
}); });
} else { } else {

View File

@@ -242,8 +242,8 @@ class Store
$mysql_access_host_array = array_map('trim', explode(',', Settings::Get('system.mysql_access_host'))); $mysql_access_host_array = array_map('trim', explode(',', Settings::Get('system.mysql_access_host')));
$mysql_access_host_array[] = $newfieldvalue; $mysql_access_host_array[] = $newfieldvalue;
$mysql_access_host_array = array_unique(\Froxlor\PhpHelper::arrayTrim($mysql_access_host_array)); $mysql_access_host_array = array_unique(\Froxlor\PhpHelper::arrayTrim($mysql_access_host_array));
$mysql_access_host = implode(',', $mysql_access_host_array);
\Froxlor\Database\DbManager::correctMysqlUsers($mysql_access_host_array); \Froxlor\Database\DbManager::correctMysqlUsers($mysql_access_host_array);
$mysql_access_host = implode(',', $mysql_access_host_array);
Settings::Set('system.mysql_access_host', $mysql_access_host); Settings::Set('system.mysql_access_host', $mysql_access_host);
} }
@@ -293,9 +293,11 @@ class Store
'cleanMySQLAccessHost' 'cleanMySQLAccessHost'
), $mysql_access_host_array); ), $mysql_access_host_array);
$mysql_access_host_array = array_unique($mysql_access_host_array); $mysql_access_host_array = array_unique(\Froxlor\PhpHelper::arrayTrim($mysql_access_host_array));
$newfieldvalue = implode(',', $mysql_access_host_array); $newfieldvalue = implode(',', $mysql_access_host_array);
\Froxlor\Database\DbManager::correctMysqlUsers($mysql_access_host_array); \Froxlor\Database\DbManager::correctMysqlUsers($mysql_access_host_array);
$mysql_access_host = implode(',', $mysql_access_host_array);
Settings::Set('system.mysql_access_host', $mysql_access_host);
} }
return $returnvalue; return $returnvalue;

View File

@@ -339,7 +339,7 @@ $lng['serversettings']['logfiles_directory']['description'] = 'Where should all
$lng['serversettings']['logfiles_script']['title'] = 'Custom script to pipe log-files to'; $lng['serversettings']['logfiles_script']['title'] = 'Custom script to pipe log-files to';
$lng['serversettings']['logfiles_script']['description'] = 'You can specify a script here and use the placeholders <strong>{LOGFILE}, {DOMAIN} and {CUSTOMER}</strong> if needed. In case you want to use it you will need to activate the <strong>Pipe webserver logfiles</strong> option too. No prefixed pipe-character is needed.'; $lng['serversettings']['logfiles_script']['description'] = 'You can specify a script here and use the placeholders <strong>{LOGFILE}, {DOMAIN} and {CUSTOMER}</strong> if needed. In case you want to use it you will need to activate the <strong>Pipe webserver logfiles</strong> option too. No prefixed pipe-character is needed.';
$lng['serversettings']['logfiles_format']['title'] = 'Access-log format'; $lng['serversettings']['logfiles_format']['title'] = 'Access-log format';
$lng['serversettings']['logfiles_format']['description'] = 'Enter a custom log-format here according to your webservers specifications, leave empty for default'; $lng['serversettings']['logfiles_format']['description'] = 'Enter a custom log-format here according to your webservers specifications, leave empty for default. Depending on your format the string must be quoted.<br/>If used with nginx, it will look like <i>log_format frx_custom {CONFIGURED_VALUE}</i>.<br/>If used with Apache, it will look like <i>LogFormat {CONFIGURED_VALUE} frx_custom</i>.<br/><strong>Attention</strong>: The code won\'t be checked for any errors. If it contains errors, webserver might not start again!';
$lng['serversettings']['logfiles_type']['title'] = 'Access-log type'; $lng['serversettings']['logfiles_type']['title'] = 'Access-log type';
$lng['serversettings']['logfiles_type']['description'] = 'Choose between <strong>combined</strong> or <strong>vhost_combined</strong> here.'; $lng['serversettings']['logfiles_type']['description'] = 'Choose between <strong>combined</strong> or <strong>vhost_combined</strong> here.';
$lng['serversettings']['logfiles_piped']['title'] = 'Pipe webserver logfiles to specified script (see above)'; $lng['serversettings']['logfiles_piped']['title'] = 'Pipe webserver logfiles to specified script (see above)';
@@ -2092,3 +2092,6 @@ $lng['admin']['domain_sessionticketsenabled']['description'] = 'Default <strong>
$lng['serversettings']['phpfpm_settings']['restart_note'] = 'Attention: The config won\'t be checked for any errors. If it contains errors, PHP-FPM might not start again!'; $lng['serversettings']['phpfpm_settings']['restart_note'] = 'Attention: The config won\'t be checked for any errors. If it contains errors, PHP-FPM might not start again!';
$lng['serversettings']['phpfpm_settings']['custom_config']['title'] = 'Custom configuration'; $lng['serversettings']['phpfpm_settings']['custom_config']['title'] = 'Custom configuration';
$lng['serversettings']['phpfpm_settings']['custom_config']['description'] = 'Add custom configuration to each PHP-FPM version instance, for example <i>pm.status_path = /status</i> for monitoring. Variables below can be used here. ' . ' <strong>' . $lng['serversettings']['phpfpm_settings']['restart_note'] . '</strong>'; $lng['serversettings']['phpfpm_settings']['custom_config']['description'] = 'Add custom configuration to each PHP-FPM version instance, for example <i>pm.status_path = /status</i> for monitoring. Variables below can be used here. ' . ' <strong>' . $lng['serversettings']['phpfpm_settings']['restart_note'] . '</strong>';
$lng['serversettings']['awstats']['logformat']['title'] = 'LogFormat setting';
$lng['serversettings']['awstats']['logformat']['description'] = 'If you use customized logformat for your webserver, you need change the awstats LogFormat too.<br/>Default is 1. For more information check documentation <a target="_blank" href="https://awstats.sourceforge.io/docs/awstats_config.html#LogFormat">here</a>.';

View File

@@ -335,7 +335,7 @@ $lng['serversettings']['logfiles_directory']['description'] = 'Wo sollen die Log
$lng['serversettings']['logfiles_script']['title'] = 'Eigenes Script zu dem Log-Files übergeben werden'; $lng['serversettings']['logfiles_script']['title'] = 'Eigenes Script zu dem Log-Files übergeben werden';
$lng['serversettings']['logfiles_script']['description'] = 'Hier kann ein Script an das die Loginhalte übergeben werden hinterlegt und die Platzhalter <strong>{LOGFILE}, {DOMAIN} und {CUSTOMER}</strong> genutzt werden, sofern nötig. Falls ein Script angegeben wird, muss die Option <strong>Webserver Logdateien umleiten</strong> gesetzt werden'; $lng['serversettings']['logfiles_script']['description'] = 'Hier kann ein Script an das die Loginhalte übergeben werden hinterlegt und die Platzhalter <strong>{LOGFILE}, {DOMAIN} und {CUSTOMER}</strong> genutzt werden, sofern nötig. Falls ein Script angegeben wird, muss die Option <strong>Webserver Logdateien umleiten</strong> gesetzt werden';
$lng['serversettings']['logfiles_format']['title'] = 'Access-Log Format'; $lng['serversettings']['logfiles_format']['title'] = 'Access-Log Format';
$lng['serversettings']['logfiles_format']['description'] = 'Hier kann ein angepasstes Log-format entsprechend der Webserver-Dokumentation angegeben werden, leer lassen für Standard'; $lng['serversettings']['logfiles_format']['description'] = 'Hier kann ein angepasstes Log-format entsprechend der Webserver-Dokumentation angegeben werden, leer lassen für Standard. Abhängig vom LogFormat muss die Angabe unter Anführungszeichen stehen.<br/>Wenn verwendet mit nginx, so kann es wie folgt aussehen: <i>log_format frx_custom {EINGESTELLTES_FORMAT}</i>.<br/>Wenn verwendet mit Apache, so kann es wie folgt aussehen: <i>LogFormat {EINGESTELLTES_FORMAT} frx_custom</i>.<br /><strong>ACHTUNG:</strong> Der Code wird nicht auf Fehler geprüft. Etwaige Fehler werden auch übernommen und der Webserver könnte nicht mehr starten!';
$lng['serversettings']['logfiles_type']['title'] = 'Access-Log Typ'; $lng['serversettings']['logfiles_type']['title'] = 'Access-Log Typ';
$lng['serversettings']['logfiles_type']['description'] = 'Wähle zwischen <strong>combined</strong> oder <strong>vhost_combined</strong>.'; $lng['serversettings']['logfiles_type']['description'] = 'Wähle zwischen <strong>combined</strong> oder <strong>vhost_combined</strong>.';
$lng['serversettings']['logfiles_piped']['title'] = 'Webserver Logdateien zu eigenem Script umleiten (siehe oben)'; $lng['serversettings']['logfiles_piped']['title'] = 'Webserver Logdateien zu eigenem Script umleiten (siehe oben)';
@@ -1739,3 +1739,6 @@ $lng['admin']['domain_sessionticketsenabled']['description'] = 'Standardwert <st
$lng['serversettings']['phpfpm_settings']['restart_note'] = 'Achtung: Der Code wird nicht auf Fehler geprüft. Bei etwaigen Fehlern könnte der PHP-FPM-Prozess nicht mehr starten!'; $lng['serversettings']['phpfpm_settings']['restart_note'] = 'Achtung: Der Code wird nicht auf Fehler geprüft. Bei etwaigen Fehlern könnte der PHP-FPM-Prozess nicht mehr starten!';
$lng['serversettings']['phpfpm_settings']['custom_config']['title'] = 'Benutzerdefinierte Konfiguration'; $lng['serversettings']['phpfpm_settings']['custom_config']['title'] = 'Benutzerdefinierte Konfiguration';
$lng['serversettings']['phpfpm_settings']['custom_config']['description'] = 'Füge eine benutzerdefinierte Einstellungen zur PHP-FPM Instanz hinzu, beispielsweise <i>pm.status_path = /status</i> für Monitoring. Unten ersichtliche Variablen können verwendet werden.' . ' <strong>' . $lng['serversettings']['phpfpm_settings']['restart_note'] . '</strong>'; $lng['serversettings']['phpfpm_settings']['custom_config']['description'] = 'Füge eine benutzerdefinierte Einstellungen zur PHP-FPM Instanz hinzu, beispielsweise <i>pm.status_path = /status</i> für Monitoring. Unten ersichtliche Variablen können verwendet werden.' . ' <strong>' . $lng['serversettings']['phpfpm_settings']['restart_note'] . '</strong>';
$lng['serversettings']['awstats']['logformat']['title'] = 'LogFormat Einstellung';
$lng['serversettings']['awstats']['logformat']['description'] = 'Wenn ein benutzerdefiniertes LogFormat beim Webserver verwendet wird, muss LogFormat von awstats ebenso angepasst werden.<br/>Standard ist 1. Für weitere Informationen siehe Dokumentation unter <a target="_blank" href="https://awstats.sourceforge.io/docs/awstats_config.html#LogFormat">hier</a>.';

View File

@@ -3,7 +3,7 @@ Include "{AWSTATS_CONF}awstats.model.conf"
LogFile="{LOG_FILE}" LogFile="{LOG_FILE}"
LogType=W LogType=W
LogFormat = 1 LogFormat = {AWSTATS_LOGFORMAT}
LogSeparator=" " LogSeparator=" "
SiteDomain="{SITE_DOMAIN}" SiteDomain="{SITE_DOMAIN}"
HostAliases="{HOST_ALIASES}" HostAliases="{HOST_ALIASES}"

View File

@@ -61,12 +61,17 @@ class CustomersTest extends TestCase
$this->assertEquals(15, $result['subdomains']); $this->assertEquals(15, $result['subdomains']);
$this->assertEquals('secret', $result['custom_notes']); $this->assertEquals('secret', $result['custom_notes']);
// validate that the std-subdomain has been added $stdsubdomain = $result['standardsubdomain'] ?? false;
$json_result = SubDomains::getLocal($admin_userdata, array( if (! $stdsubdomain) {
'id' => $result['standardsubdomain'] $this->fail('No standardsubdomain where there should be one');
))->get(); } else {
$result = json_decode($json_result, true)['data']; // validate that the std-subdomain has been added
$this->assertEquals('test1.dev.froxlor.org', $result['domain']); $json_result = SubDomains::getLocal($admin_userdata, array(
'id' => $result['standardsubdomain']
))->get();
$result = json_decode($json_result, true)['data'];
$this->assertEquals('test1.dev.froxlor.org', $result['domain']);
}
} }
public function testAdminCustomersAddEmptyMail() public function testAdminCustomersAddEmptyMail()

View File

@@ -38,6 +38,7 @@ class DomainsTest extends TestCase
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
$this->assertEquals($customer_userdata['documentroot'] . 'test.local/', $result['documentroot']); $this->assertEquals($customer_userdata['documentroot'] . 'test.local/', $result['documentroot']);
$this->assertTrue(in_array('TLSv1.3', explode(",", $result['ssl_protocols']))); $this->assertTrue(in_array('TLSv1.3', explode(",", $result['ssl_protocols'])));
$this->assertEquals('0', $result['isemaildomain']);
} }
/** /**

View File

@@ -1,10 +1,12 @@
<?php <?php
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Froxlor\Settings;
use Froxlor\Api\Commands\Admins; use Froxlor\Api\Commands\Admins;
use Froxlor\Api\Commands\Customers; use Froxlor\Api\Commands\Customers;
use Froxlor\Api\Commands\Mysqls; use Froxlor\Api\Commands\Mysqls;
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\Settings\Store;
/** /**
* *
@@ -15,6 +17,7 @@ use Froxlor\Database\Database;
* @covers \Froxlor\Api\Commands\Admins * @covers \Froxlor\Api\Commands\Admins
* @covers \Froxlor\Database\DbManager * @covers \Froxlor\Database\DbManager
* @covers \Froxlor\Database\Manager\DbManagerMySQL * @covers \Froxlor\Database\Manager\DbManagerMySQL
* @covers \Froxlor\Settings\Store
*/ */
class MysqlsTest extends TestCase class MysqlsTest extends TestCase
{ {
@@ -183,6 +186,24 @@ class MysqlsTest extends TestCase
* *
* @depends testCustomerMysqlsAdd * @depends testCustomerMysqlsAdd
*/ */
public function testStoreSettingIpAddress()
{
// this settings test is here because it directly changes mysql users / privileges
$fielddata = array(
'label' => 'serversettings.ipaddress',
'settinggroup' => 'system',
'varname' => 'ipaddress'
);
Store::storeSettingIpAddress('system_system_ipaddress', $fielddata, '82.149.225.47');
$mysql_access_hosts = Settings::Get('system.mysql_access_host');
$this->assertTrue(strpos($mysql_access_hosts, '82.149.225.47') !== false);
}
/**
*
* @depends testStoreSettingIpAddress
*/
public function testGetAllSqlUsers() public function testGetAllSqlUsers()
{ {
\Froxlor\Database\Database::needRoot(true); \Froxlor\Database\Database::needRoot(true);