more implementing of new Settings class, refs #1325

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-12-15 12:40:24 +01:00
parent eb33493c79
commit 558108008a
20 changed files with 245 additions and 312 deletions

View File

@@ -21,19 +21,9 @@
class ConfigIO {
/**
* internal settings array
*
* @var array
* constructor
*/
private $_settings = null;
/**
* constructor gets the froxlor settings
* as array
*/
public function __construct(array $settings = null) {
$this->_settings = $settings;
}
public function __construct() {}
/**
* clean up former created configs, including (if enabled)
@@ -73,7 +63,7 @@ class ConfigIO {
/*
* only clean up if we're actually using SSL
*/
if ($this->_settings['system']['use_ssl'] == '1') {
if (Settings::Get('system.use_ssl') == '1') {
// get correct directory
$configdir = $this->_getFile('system', 'customer_ssl_path');
if ($configdir !== false) {
@@ -158,7 +148,7 @@ class ConfigIO {
*/
private function _cleanAwstatsFiles() {
if ($this->_settings['system']['awstats_enabled'] == '0') {
if (Settings::Get('system.awstats_enabled') == '0') {
return;
}
@@ -204,7 +194,7 @@ class ConfigIO {
*/
private function _cleanFcgidFiles() {
if ($this->_settings['system']['mod_fcgid'] == '0') {
if (Settings::Get('system.mod_fcgid') == '0') {
return;
}
@@ -246,7 +236,7 @@ class ConfigIO {
*/
private function _cleanFpmFiles() {
if ($this->_settings['phpfpm']['enabled'] == '0') {
if (Settings::Get('phpfpm.enabled') == '0') {
return;
}
@@ -276,7 +266,7 @@ class ConfigIO {
}
/**
* returns a file/direcotry from the settings array and checks whether it exists
* returns a file/direcotry from the settings and checks whether it exists
*
* @param string $group settings-group
* @param string $varname var-name
@@ -287,7 +277,7 @@ class ConfigIO {
private function _getFile($group, $varname, $check_exists = true) {
// read from settings
$file = $this->_settings[$group][$varname];
$file = Settings::Get($group.'.'.$varname);
// check whether it exists
if ($check_exists && @file_exists($file) == false) {

View File

@@ -21,18 +21,9 @@
class DomainSSL {
/**
* internal settings array
*
* @var array
* constructor
*/
private $_settings = null;
/**
* constructor gets the froxlor settings as array
*/
public function __construct(array $settings = null) {
$this->_settings = $settings;
}
public function __construct() {}
/**
* read domain-related (or if empty, parentdomain-related) ssl-certificates from the database
@@ -66,7 +57,7 @@ class DomainSSL {
&& $dom_certs['ssl_cert_file'] != ''
) {
// get destination path
$sslcertpath = makeCorrectDir($this->_settings['system']['customer_ssl_path']);
$sslcertpath = makeCorrectDir(Settings::Get('system.customer_ssl_path'));
// create path if it does not exist
if (!file_exists($sslcertpath)) {
safe_exec('mkdir -p '.escapeshellarg($sslcertpath));
@@ -77,7 +68,7 @@ class DomainSSL {
'ssl_key_file' => makeCorrectFile($sslcertpath.'/'.$domain['domain'].'.key')
);
if ($this->_settings['system']['webserver'] == 'lighttpd') {
if (Settings::Get('system.webserver') == 'lighttpd') {
// put my.crt and my.key together for lighty.
$dom_certs['ssl_cert_file'] = trim($dom_certs['ssl_cert_file'])."\n".trim($dom_certs['ssl_key_file'])."\n";
$ssl_files['ssl_key_file'] = '';
@@ -91,7 +82,7 @@ class DomainSSL {
$ssl_files['ssl_ca_file'] = makeCorrectFile($sslcertpath.'/'.$domain['domain'].'_CA.pem');
}
if ($dom_certs['ssl_cert_chainfile'] != '') {
if ($this->_settings['system']['webserver'] == 'nginx') {
if (Settings::Get('system.webserver') == 'nginx') {
// put ca.crt in my.crt, as nginx does not support a separate chain file.
$dom_certs['ssl_cert_file'] = trim($dom_certs['ssl_cert_file'])."\n".trim($dom_certs['ssl_cert_chainfile'])."\n";
} else {
@@ -117,4 +108,4 @@ class DomainSSL {
return;
}
}
}