Merge remote-tracking branch 'origin/master' into 0.10.0
This commit is contained in:
@@ -104,14 +104,37 @@ return array(
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_logfiles_directory' => array(
|
||||
'label' => (Settings::Get('system.webserver') != 'apache2') ? $lng['serversettings']['logfiles_directory'] : $lng['serversettings']['logfiles_directory2'],
|
||||
'label' => $lng['serversettings']['logfiles_directory'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'logfiles_directory',
|
||||
'type' => 'string',
|
||||
'string_type' => (Settings::Get('system.webserver') != 'apache2') ? 'dir' : '',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/var/customers/logs/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_logfiles_script' => array(
|
||||
'label' => $lng['serversettings']['logfiles_script'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'logfiles_script',
|
||||
'type' => 'string',
|
||||
'string_type' => '',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
)
|
||||
),
|
||||
'system_logfiles_piped' => array(
|
||||
'label' => $lng['serversettings']['logfiles_piped'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'logfiles_piped',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
)
|
||||
),
|
||||
'system_logfiles_format' => array(
|
||||
'label' => $lng['serversettings']['logfiles_format'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -141,17 +164,6 @@ return array(
|
||||
'apache2'
|
||||
)
|
||||
),
|
||||
'system_logfiles_piped' => array(
|
||||
'label' => $lng['serversettings']['logfiles_piped'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'logfiles_piped',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
)
|
||||
),
|
||||
'system_customersslpath' => array(
|
||||
'label' => $lng['serversettings']['customerssl_directory'],
|
||||
'settinggroup' => 'system',
|
||||
|
||||
@@ -367,6 +367,7 @@ if ($page == 'overview') {
|
||||
if (!empty($existing_backupJob)) {
|
||||
$action = "abort";
|
||||
$row = $existing_backupJob['data'];
|
||||
|
||||
$row['path'] = makeCorrectDir(str_replace($userinfo['documentroot'], "/", $row['destdir']));
|
||||
$row['backup_web'] = ($row['backup_web'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];
|
||||
$row['backup_mail'] = ($row['backup_mail'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];
|
||||
|
||||
@@ -660,6 +660,7 @@ opcache.interned_strings_buffer'),
|
||||
('system', 'logfiles_format', ''),
|
||||
('system', 'logfiles_type', '1'),
|
||||
('system', 'logfiles_piped', '0'),
|
||||
('system', 'logfiles_script', ''),
|
||||
('api', 'enabled', '0'),
|
||||
('panel', 'decimal_places', '4'),
|
||||
('panel', 'adminmail', 'admin@SERVERNAME'),
|
||||
@@ -693,7 +694,7 @@ opcache.interned_strings_buffer'),
|
||||
('panel', 'password_special_char', '!?<>§$%+#=@'),
|
||||
('panel', 'customer_hide_options', ''),
|
||||
('panel', 'version', '0.10.0'),
|
||||
('panel', 'db_version', '201805240');
|
||||
('panel', 'db_version', '201805290');
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `panel_tasks`;
|
||||
|
||||
@@ -60,7 +60,7 @@ if (isFroxlorVersion('0.10.0')) {
|
||||
Database::query("ALTER TABLE `panel_admins` MODIFY `ip` varchar(500) NOT NULL default '-1';");
|
||||
$upd_stmt = Database::prepare("UPDATE `panel_admins` SET `ip` = :ip WHERE `adminid` = :adminid");
|
||||
foreach ($all_admins as $adm) {
|
||||
if ($admin['ip'] != -1) {
|
||||
if ($admin['ip'] != '-1') {
|
||||
Database::pexecute($upd_stmt, array('ip' => json_encode($adm['ip']), 'adminid' => $adm['adminid']));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3959,3 +3959,42 @@ if (isDatabaseVersion('201802250')) {
|
||||
|
||||
updateToDbVersion('201805240');
|
||||
}
|
||||
|
||||
if (isDatabaseVersion('201805240')) {
|
||||
|
||||
showUpdateStep("Adding webserver logfile-script settings");
|
||||
Settings::AddNew("system.logfiles_script", '');
|
||||
lastStepStatus(0);
|
||||
|
||||
updateToDbVersion('201805241');
|
||||
}
|
||||
|
||||
if (isDatabaseVersion('201805241')) {
|
||||
|
||||
$do_update = true;
|
||||
showUpdateStep("Checking for required PHP json-extension");
|
||||
if (! extension_loaded('json')) {
|
||||
$do_update = false;
|
||||
lastStepStatus(2, 'not installed');
|
||||
} else {
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Checking for current cronjobs that need converting");
|
||||
$result_tasks_stmt = Database::query("
|
||||
SELECT * FROM `" . TABLE_PANEL_TASKS . "` ORDER BY `id` ASC
|
||||
");
|
||||
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_TASKS . "` SET `data` = :data WHERE `id` = :taskid");
|
||||
while ($row = $result_tasks_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if (! empty($row['data'])) {
|
||||
$data = unserialize($row['data']);
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'data' => json_encode($data),
|
||||
'taskid' => $row['id']
|
||||
));
|
||||
}
|
||||
}
|
||||
lastStepStatus(0);
|
||||
|
||||
updateToDbVersion('201805290');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ class CustomerBackups extends ApiCommand implements ResourceEntity
|
||||
Database::pexecute($sel_stmt);
|
||||
$result = array();
|
||||
while ($entry = $sel_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$entry['data'] = unserialize($entry['data']);
|
||||
$entry['data'] = json_decode($entry['data'], true);
|
||||
if (in_array($entry['data']['customerid'], $customer_ids)) {
|
||||
$result[] = $entry;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ class DomainZones extends ApiCommand implements ResourceEntity
|
||||
|
||||
// check for duplicate
|
||||
foreach ($dom_entries as $existing_entry) {
|
||||
// compare serialized string of array
|
||||
// compare json-encoded string of array
|
||||
$check_entry = $existing_entry;
|
||||
// new entry has no ID yet
|
||||
unset($check_entry['id']);
|
||||
@@ -225,9 +225,9 @@ class DomainZones extends ApiCommand implements ResourceEntity
|
||||
$check_entry['prio'] = (int) $check_entry['prio'];
|
||||
$check_entry['ttl'] = (int) $check_entry['ttl'];
|
||||
$check_entry['domain_id'] = (int) $check_entry['domain_id'];
|
||||
// serialize both
|
||||
$check_entry = serialize($check_entry);
|
||||
$new = serialize($new_entry);
|
||||
// encode both
|
||||
$check_entry = json_encode($check_entry);
|
||||
$new = json_encode($new_entry);
|
||||
// compare
|
||||
if ($check_entry === $new) {
|
||||
$errors[] = $this->lng['error']['dns_duplicate_entry'];
|
||||
|
||||
@@ -314,7 +314,7 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
$ssl_redirect = 0;
|
||||
$letsencrypt = 0;
|
||||
$http2 = 0;
|
||||
// we need this for the serialize
|
||||
// we need this for the json_encode
|
||||
// if ssl is disabled or no ssl-ip/port exists
|
||||
$ssl_ipandports[] = - 1;
|
||||
|
||||
@@ -383,7 +383,7 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
}
|
||||
|
||||
if (count($ssl_ipandports) == 0) {
|
||||
// we need this for the serialize
|
||||
// we need this for the json_encode
|
||||
// if ssl is disabled or no ssl-ip/port exists
|
||||
$ssl_ipandports[] = - 1;
|
||||
}
|
||||
@@ -900,7 +900,7 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
$ssl_redirect = 0;
|
||||
$letsencrypt = 0;
|
||||
$http2 = 0;
|
||||
// we need this for the serialize
|
||||
// we need this for the json_encode
|
||||
// if ssl is disabled or no ssl-ip/port exists
|
||||
$ssl_ipandports[] = - 1;
|
||||
|
||||
@@ -993,7 +993,7 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
}
|
||||
|
||||
if (count($ssl_ipandports) == 0) {
|
||||
// we need this for the serialize
|
||||
// we need this for the json_encode
|
||||
// if ssl is disabled or no ssl-ip/port exists
|
||||
$ssl_ipandports[] = - 1;
|
||||
}
|
||||
@@ -1532,7 +1532,7 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
);
|
||||
}
|
||||
if (! empty($p_ipandports) && ! is_array($p_ipandports)) {
|
||||
$p_ipandports = unserialize($p_ipandports);
|
||||
$p_ipandports = json_decode($p_ipandports, true);
|
||||
}
|
||||
|
||||
// check whether there are ip usage restrictions
|
||||
|
||||
@@ -114,7 +114,7 @@ class paging {
|
||||
$this->userinfo = $userinfo;
|
||||
|
||||
if (!is_array($this->userinfo['lastpaging'])) {
|
||||
$this->userinfo['lastpaging'] = unserialize($this->userinfo['lastpaging']);
|
||||
$this->userinfo['lastpaging'] = json_decode($this->userinfo['lastpaging'], true);
|
||||
}
|
||||
|
||||
$this->table = $table;
|
||||
@@ -224,7 +224,7 @@ class paging {
|
||||
AND `adminsession` = :adminsession
|
||||
");
|
||||
$upd_data = array(
|
||||
'lastpaging' => serialize($this->userinfo['lastpaging']),
|
||||
'lastpaging' => json_encode($this->userinfo['lastpaging']),
|
||||
'hash' => $userinfo['hash'],
|
||||
'userid' => $userinfo['userid'],
|
||||
'ipaddr' => $userinfo['ipaddress'],
|
||||
|
||||
@@ -63,7 +63,7 @@ function getOutstandingTasks() {
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if ($row['data'] != '') {
|
||||
$row['data'] = unserialize($row['data']);
|
||||
$row['data'] = json_decode($row['data'], true);
|
||||
}
|
||||
|
||||
// rebuilding webserver-configuration
|
||||
|
||||
@@ -70,7 +70,7 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '
|
||||
$data['uid'] = $param2;
|
||||
$data['gid'] = $param3;
|
||||
$data['store_defaultindex'] = $param4;
|
||||
$data = serialize($data);
|
||||
$data = json_encode($data);
|
||||
Database::pexecute($ins_stmt, array('type' => '2', 'data' => $data));
|
||||
|
||||
} elseif ($type == '6'
|
||||
@@ -78,7 +78,7 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '
|
||||
) {
|
||||
$data = array();
|
||||
$data['loginname'] = $param1;
|
||||
$data = serialize($data);
|
||||
$data = json_encode($data);
|
||||
Database::pexecute($ins_stmt, array('type' => '6', 'data' => $data));
|
||||
|
||||
} elseif ($type == '7'
|
||||
@@ -88,7 +88,7 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '
|
||||
$data = array();
|
||||
$data['loginname'] = $param1;
|
||||
$data['email'] = $param2;
|
||||
$data = serialize($data);
|
||||
$data = json_encode($data);
|
||||
Database::pexecute($ins_stmt, array('type' => '7', 'data' => $data));
|
||||
|
||||
} elseif ($type == '8'
|
||||
@@ -98,13 +98,13 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '
|
||||
$data = array();
|
||||
$data['loginname'] = $param1;
|
||||
$data['homedir'] = $param2;
|
||||
$data = serialize($data);
|
||||
$data = json_encode($data);
|
||||
Database::pexecute($ins_stmt, array('type' => '8', 'data' => $data));
|
||||
|
||||
} elseif ($type == '20'
|
||||
&& is_array($param1)
|
||||
) {
|
||||
$data = serialize($param1);
|
||||
$data = json_encode($param1);
|
||||
Database::pexecute($ins_stmt, array('type' => '20', 'data' => $data));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ function getDomainRedirectCode($domainid = 0) {
|
||||
$default = '301';
|
||||
if (Settings::Get('customredirect.enabled') == '1') {
|
||||
$all_codes = getRedirectCodes(false);
|
||||
$default = $all_codes[Settings::Get('customredirect.default')];
|
||||
$_default = $all_codes[Settings::Get('customredirect.default')];
|
||||
$default = ($_default == '---') ? $default : $_default;
|
||||
}
|
||||
$code = $default;
|
||||
if ($domainid > 0) {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
$version = '0.10.0';
|
||||
|
||||
// Database version (YYYYMMDDC where C is a daily counter)
|
||||
$dbversion = '201805240';
|
||||
$dbversion = '201805290';
|
||||
|
||||
// Distribution branding-tag (used for Debian etc.)
|
||||
$branding = '';
|
||||
|
||||
@@ -337,8 +337,8 @@ $lng['serversettings']['documentroot_prefix']['title'] = 'Home directory';
|
||||
$lng['serversettings']['documentroot_prefix']['description'] = 'Where should all home directories be stored?';
|
||||
$lng['serversettings']['logfiles_directory']['title'] = 'Logfiles directory';
|
||||
$lng['serversettings']['logfiles_directory']['description'] = 'Where should all log files be stored?';
|
||||
$lng['serversettings']['logfiles_directory2']['title'] = 'Logfiles directory or custom script';
|
||||
$lng['serversettings']['logfiles_directory2']['description'] = 'Where should all log files be stored? Optionally, you can specify a script here and use the placeholders <strong>{LOGFILE}, {DOMAIN} and {CUSTOMER}</strong> if needed. In case of a custom script you will need to activate the <strong>Pipe webserver logfiles</strong> option';
|
||||
$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_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_type']['title'] = 'Access-log type';
|
||||
|
||||
@@ -333,8 +333,8 @@ $lng['serversettings']['documentroot_prefix']['title'] = 'Heimatverzeichnis';
|
||||
$lng['serversettings']['documentroot_prefix']['description'] = 'Wo sollen die Heimatverzeichnisse der Kunden liegen?';
|
||||
$lng['serversettings']['logfiles_directory']['title'] = 'Webserver-Logdateien-Verzeichnis';
|
||||
$lng['serversettings']['logfiles_directory']['description'] = 'Wo sollen die Logdateien des Webservers liegen?';
|
||||
$lng['serversettings']['logfiles_directory2']['title'] = 'Webserver-Logdateien-Verzeichnis oder eigenes Script';
|
||||
$lng['serversettings']['logfiles_directory2']['description'] = 'Wo sollen die Logdateien des Webservers liegen? Optional kann hier ein Script 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']['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_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_type']['title'] = 'Access-Log Typ';
|
||||
|
||||
@@ -79,7 +79,7 @@ $all_jobs = $result_tasks_stmt->fetchAll();
|
||||
foreach ($all_jobs as $row) {
|
||||
|
||||
if ($row['data'] != '') {
|
||||
$row['data'] = unserialize($row['data']);
|
||||
$row['data'] = json_decode($row['data'], true);
|
||||
}
|
||||
|
||||
if (is_array($row['data'])) {
|
||||
|
||||
@@ -733,19 +733,16 @@ class apache extends HttpConfigBase
|
||||
$logtype = 'vhost_combined';
|
||||
}
|
||||
|
||||
if (Settings::Get('system.logfiles_piped') == '1') {
|
||||
// don't use custom-script as path for logfile-names
|
||||
$error_log = makeCorrectFile($domain['loginname'] . $speciallogfile . '-error.log');
|
||||
$access_log = makeCorrectFile($domain['loginname'] . $speciallogfile . '-access.log');
|
||||
if (Settings::Get('system.logfiles_piped') == '1' && Settings::Get('system.logfiles_script') != '') {
|
||||
// replace for error_log
|
||||
$command = replace_variables(Settings::Get('system.logfiles_directory'), array(
|
||||
$command = replace_variables(Settings::Get('system.logfiles_script'), array(
|
||||
'LOGFILE' => $error_log,
|
||||
'DOMAIN' => $domain['domain'],
|
||||
'CUSTOMER' => $domain['loginname']
|
||||
));
|
||||
$logfiles_text .= ' ErrorLog "| ' . $command . "\"\n";
|
||||
// replace for access_log
|
||||
$command = replace_variables(Settings::Get('system.logfiles_directory'), array(
|
||||
$command = replace_variables(Settings::Get('system.logfiles_script'), array(
|
||||
'LOGFILE' => $access_log,
|
||||
'DOMAIN' => $domain['domain'],
|
||||
'CUSTOMER' => $domain['loginname']
|
||||
|
||||
@@ -43,7 +43,7 @@ while ($row = $result_tasks_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$resultIDs[] = $row['id'];
|
||||
|
||||
if ($row['data'] != '') {
|
||||
$row['data'] = unserialize($row['data']);
|
||||
$row['data'] = json_decode($row['data'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @covers ApiParameter
|
||||
*/
|
||||
class ApiParameterTest extends TestCase
|
||||
@@ -14,5 +15,4 @@ class ApiParameterTest extends TestCase
|
||||
$this->expectExceptionMessage('Requested parameter "key" could not be found for "Froxlor:getSetting"');
|
||||
Froxlor::getLocal($admin_userdata)->getSetting();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user