tiny fixes in nginx-cronjob; clean up unused code from lighttpd cronjob

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-05-03 09:50:07 +02:00
parent 4825c77e2e
commit e0db240a3f
2 changed files with 81 additions and 133 deletions

View File

@@ -17,10 +17,6 @@
*
*/
/*
* This script creates the php.ini's used by mod_suPHP+php-cgi
*/
if(@php_sapi_name() != 'cli'
&& @php_sapi_name() != 'cgi'
&& @php_sapi_name() != 'cgi-fcgi')
@@ -389,8 +385,6 @@ class lighttpd
if ($this->lighttpd_data[$vhost_filename] == '') {
$this->lighttpd_data[$vhost_filename] .= $this->getVhostContent($domain, $ssl_vhost, $ipid);
}
// FIXME did this ever work?
//$this->lighttpd_data[$vhost_filename].= isset($this->needed_htpasswds[$domain[$ips_and_ports_index]]) ? $this->needed_htpasswds[$domain[$ips_and_ports_index]] . "\n" : '';
}
}
return $included_vhosts;
@@ -620,53 +614,6 @@ class lighttpd
return $path_options;
}
protected function getDirOptions($domain)
{
$query = "SELECT * FROM " . TABLE_PANEL_HTPASSWDS . " WHERE `customerid`='" . $domain['customerid'] . "'";
$result = $this->db->query($query);
while ($row_htpasswds = $this->db->fetch_array($result)) {
if ($auth_backend_loaded[$domain['ipandport']] != 'yes'
&& $auth_backend_loaded[$domain['ssl_ipandport']] != 'yes'
) {
$filename = $domain['customerid'] . '.htpasswd';
if ($this->auth_backend_loaded[$domain['ipandport']] != 'yes') {
$auth_backend_loaded[$domain['ipandport']] = 'yes';
$diroption_text.= 'auth.backend = "htpasswd"' . "\n";
$diroption_text.= 'auth.backend.htpasswd.userfile = "' . makeCorrectFile($this->settings['system']['apacheconf_htpasswddir'] . '/' . $filename) . '"' . "\n";
$this->needed_htpasswds[$filename] = $row_htpasswds['username'] . ':' . $row_htpasswds['password'] . "\n";
$diroption_text.= 'auth.require = ( ' . "\n";
$previous_domain_id = '1';
} elseif($this->auth_backend_loaded[$domain['ssl_ipandport']] != 'yes') {
$auth_backend_loaded[$domain['ssl_ipandport']] = 'yes';
$diroption_text.= 'auth.backend= "htpasswd"' . "\n";
$diroption_text.= 'auth.backend.htpasswd.userfile = "' . makeCorrectFile($this->settings['system']['apacheconf_htpasswddir'] . '/' . $filename) . '"' . "\n";
$this->needed_htpasswds[$filename] = $row_htpasswds['username'] . ':' . $row_htpasswds['password'] . "\n";
$diroption_text.= 'auth.require = ( ' . "\n";
$previous_domain_id = '1';
}
}
$diroption_text.= '"' . makeCorrectDir($row_htpasswds['path']) . '" =>' . "\n";
$diroption_text.= '(' . "\n";
$diroption_text.= ' "method" => "basic",' . "\n";
$diroption_text.= ' "realm" => "'.$row_htpasswds['authname'].'",' . "\n";
$diroption_text.= ' "require" => "valid-user"' . "\n";
$diroption_text.= ')' . "\n";
if ($this->auth_backend_loaded[$domain['ssl_ipandport']] == 'yes') {
$this->needed_htpasswds[$domain['ssl_ipandport']].= $diroption_text;
}
if ($this->auth_backend_loaded[$domain['ipandport']] != 'yes') {
$this->needed_htpasswds[$domain['ipandport']].= $diroption_text;
}
}
return ' auth.backend.htpasswd.userfile = "' . makeCorrectFile($this->settings['system']['apacheconf_htpasswddir'] . '/' . $filename) . '"' . "\n";
}
protected function getServerNames($domain)
{
$server_string = array();
@@ -857,7 +804,6 @@ class lighttpd
}
// Write the diroptions
if (isConfigDir($this->settings['system']['apacheconf_htpasswddir'])) {
foreach ($this->needed_htpasswds as $key => $data) {
if (!is_dir($this->settings['system']['apacheconf_htpasswddir'])) {

View File

@@ -251,7 +251,6 @@ class nginx
$this->nginx_data[$vhost_filename] .= '}' . "\n\n";
// End of Froxlor server{}-part
}
$this->createNginxHosts($row_ipsandports['ip'], $row_ipsandports['port'], $row_ipsandports['ssl'], $vhost_filename);
}
$this->createNginxHosts();
@@ -353,9 +352,8 @@ class nginx
}
$vhost_content = '';
$vhost_content.= 'server { ' . "\n";
$query = "SELECT * FROM `".TABLE_PANEL_IPSANDPORTS."` `i`, `".TABLE_DOMAINTOIP."` `dip` WHERE dip.id_domain = '$domain[id]' AND i.id = dip.id_ipandports ";
$query = "SELECT * FROM `".TABLE_PANEL_IPSANDPORTS."` `i`, `".TABLE_DOMAINTOIP."` `dip` WHERE dip.id_domain = '".$domain['id']."' AND i.id = dip.id_ipandports ";
if ($ssl_vhost === true
&& ($domain['ssl'] == '1' || $domain['ssl_redirect'] == '1')
) {
@@ -378,14 +376,15 @@ class nginx
$ipport = $domain['ip'] . ':' . $domain['port'];
}
$vhost_content.= "\t" . 'listen ' . $ipport . ($ssl_vhost == true ? ' ssl' : '') . ';' . "\n";
}
$domain['ssl_cert_file'] = $ipandport['ssl_cert_file']; // save latest delivered ssl settings
$domain['ssl_key_file'] = $ipandport['ssl_key_file'];
$domain['ssl_ca_file'] = $ipandport['ssl_ca_file'];
// #418
$domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile'];
$vhost_content.= 'server { ' . "\n";
$vhost_content.= "\t" . 'listen ' . $ipport . ($ssl_vhost == true ? ' ssl' : '') . ';' . "\n";
// get all server-names
$vhost_content .= $this->getServerNames($domain);
@@ -446,7 +445,7 @@ class nginx
}
}
$vhost_content .= '}' . "\n\n";
}
return $vhost_content;
}
@@ -475,7 +474,10 @@ class nginx
// FIXME ssl on now belongs to the listen block as 'ssl' at the end
$sslsettings .= "\t" . 'ssl on;' . "\n";
$sslsettings .= "\t" . 'ssl_certificate ' . makeCorrectFile($domain['ssl_cert_file']) . ';' . "\n";
if ($domain['ssl_key_file'] != '') {
$sslsettings .= "\t" . 'ssl_certificate_key ' .makeCorrectFile($domain['ssl_key_file']) . ';' . "\n";
}
if ($domain['ssl_ca_file'] != '') {
$sslsettings.= 'ssl_client_certificate ' . makeCorrectFile($domain['ssl_ca_file']) . ';' . "\n";