Skip to content

Commit 1bd2693

Browse files
committed
Updated Fedora and OpenSUSE install libraries.
1 parent a2156eb commit 1bd2693

File tree

2 files changed

+173
-76
lines changed

2 files changed

+173
-76
lines changed

install/dist/lib/fedora.lib.php

Lines changed: 87 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ public function configure_apache()
497497
{
498498
global $conf;
499499

500+
if($conf['apache']['installed'] == false) return;
500501
if(is_file('/etc/suphp.conf')) {
501502
//replaceLine('/etc/suphp.conf','php=php:/usr/bin','x-httpd-suphp=php:/usr/bin/php-cgi',0);
502503
replaceLine('/etc/suphp.conf','docroot=','docroot=/var/www',0);
@@ -741,6 +742,8 @@ public function install_ispconfig()
741742
if (is_dir($dir)) {
742743
if ($dh = opendir($dir)) {
743744
while (($file = readdir($dh)) !== false) {
745+
if($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') continue;
746+
if($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') continue;
744747
if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
745748
include_once($install_dir.'/server/plugins-available/'.$file);
746749
$plugin_name = substr($file,0,-8);
@@ -822,55 +825,100 @@ public function install_ispconfig()
822825
$command = "chmod +x $install_dir/server/scripts/*.sh";
823826
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
824827

825-
//* Copy the ISPConfig vhost for the controlpanel
826-
// TODO: These are missing! should they be "vhost_dist_*_dir" ?
827-
$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
828-
$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
828+
if($conf['apache']['installed'] == true){
829+
//* Copy the ISPConfig vhost for the controlpanel
830+
// TODO: These are missing! should they be "vhost_dist_*_dir" ?
831+
$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
832+
$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
829833

830834

831-
// Dont just copy over the virtualhost template but add some custom settings
832-
$content = rf("tpl/apache_ispconfig.vhost.master");
833-
$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
835+
// Dont just copy over the virtualhost template but add some custom settings
836+
$content = rf("tpl/apache_ispconfig.vhost.master");
837+
$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
838+
839+
// comment out the listen directive if port is 80 or 443
840+
if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
841+
$content = str_replace('{vhost_port_listen}', '#', $content);
842+
} else {
843+
$content = str_replace('{vhost_port_listen}', '', $content);
844+
}
834845

835-
// comment out the listen directive if port is 80 or 443
836-
if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
837-
$content = str_replace('{vhost_port_listen}', '#', $content);
838-
} else {
839-
$content = str_replace('{vhost_port_listen}', '', $content);
840-
}
846+
if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) {
847+
$content = str_replace('{ssl_comment}', '', $content);
848+
} else {
849+
$content = str_replace('{ssl_comment}', '#', $content);
850+
}
841851

842-
if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) {
843-
$content = str_replace('{ssl_comment}', '', $content);
844-
} else {
845-
$content = str_replace('{ssl_comment}', '#', $content);
846-
}
852+
wf("$vhost_conf_dir/ispconfig.vhost", $content);
847853

848-
wf("$vhost_conf_dir/ispconfig.vhost", $content);
854+
//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
855+
//* and create the symlink
856+
if($this->install_ispconfig_interface == true && $this->is_update == false) {
857+
if(@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
858+
if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
859+
exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
860+
}
861+
862+
exec('mkdir -p /var/www/php-fcgi-scripts/ispconfig');
863+
exec('cp tpl/apache_ispconfig_fcgi_starter.master /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
864+
exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
865+
exec('ln -s /usr/local/ispconfig/interface/web /var/www/ispconfig');
866+
exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
867+
868+
replaceLine('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter','PHPRC=','PHPRC=/etc/',0,0);
869+
}
849870

850-
//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
851-
//* and create the symlink
852-
if($this->install_ispconfig_interface == true && $this->is_update == false) {
853-
if(@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
854-
if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
855-
exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
871+
//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
872+
//* and create the symlink
873+
if($this->install_ispconfig_interface == true && $this->is_update == false) {
874+
if(@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
875+
if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
876+
exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
877+
}
878+
}
879+
}
880+
881+
if($conf['nginx']['installed'] == true){
882+
//* Copy the ISPConfig vhost for the controlpanel
883+
$vhost_conf_dir = $conf['nginx']['vhost_conf_dir'];
884+
$vhost_conf_enabled_dir = $conf['nginx']['vhost_conf_enabled_dir'];
885+
886+
// Dont just copy over the virtualhost template but add some custom settings
887+
$content = rf('tpl/nginx_ispconfig.vhost.master');
888+
$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
889+
890+
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
891+
$content = str_replace('{ssl_on}', ' ssl', $content);
892+
$content = str_replace('{ssl_comment}', '', $content);
893+
$content = str_replace('{fastcgi_ssl}', 'on', $content);
894+
} else {
895+
$content = str_replace('{ssl_on}', '', $content);
896+
$content = str_replace('{ssl_comment}', '#', $content);
897+
$content = str_replace('{fastcgi_ssl}', 'off', $content);
856898
}
857899

858-
exec('mkdir -p /var/www/php-fcgi-scripts/ispconfig');
859-
exec('cp tpl/apache_ispconfig_fcgi_starter.master /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
860-
exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
861-
exec('ln -s /usr/local/ispconfig/interface/web /var/www/ispconfig');
862-
exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
900+
$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
901+
902+
wf($vhost_conf_dir.'/ispconfig.vhost', $content);
863903

864-
replaceLine('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter','PHPRC=','PHPRC=/etc/',0,0);
904+
unset($content);
865905

866-
}
867-
868-
//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
869-
//* and create the symlink
870-
if($this->install_ispconfig_interface == true && $this->is_update == false) {
871-
if(@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
872-
if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
873-
exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
906+
// PHP-FPM
907+
// Dont just copy over the php-fpm pool template but add some custom settings
908+
$content = rf('tpl/php_fpm_pool.conf.master');
909+
$content = str_replace('{fpm_pool}', 'ispconfig', $content);
910+
$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
911+
$content = str_replace('{fpm_user}', 'ispconfig', $content);
912+
$content = str_replace('{fpm_group}', 'ispconfig', $content);
913+
wf($conf['nginx']['php_fpm_pool_dir'].'/ispconfig.conf', $content);
914+
915+
//copy('tpl/nginx_ispconfig.vhost.master', $vhost_conf_dir.'/ispconfig.vhost');
916+
//* and create the symlink
917+
if($this->install_ispconfig_interface == true && $this->is_update == false) {
918+
if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost');
919+
if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) {
920+
symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost');
921+
}
874922
}
875923
}
876924

install/dist/lib/opensuse.lib.php

Lines changed: 86 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ public function configure_apache()
510510
{
511511
global $conf;
512512

513+
if($conf['apache']['installed'] == false) return;
513514
//* Create the logging directory for the vhost logfiles
514515
exec('mkdir -p /var/log/ispconfig/httpd');
515516

@@ -754,6 +755,8 @@ public function install_ispconfig()
754755
if (is_dir($dir)) {
755756
if ($dh = opendir($dir)) {
756757
while (($file = readdir($dh)) !== false) {
758+
if($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') continue;
759+
if($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') continue;
757760
if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
758761
include_once($install_dir.'/server/plugins-available/'.$file);
759762
$plugin_name = substr($file,0,-8);
@@ -835,57 +838,103 @@ public function install_ispconfig()
835838
$command = "chmod +x $install_dir/server/scripts/*.sh";
836839
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
837840

838-
//* Copy the ISPConfig vhost for the controlpanel
839-
// TODO: These are missing! should they be "vhost_dist_*_dir" ?
840-
$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
841-
$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
841+
842+
if($conf['apache']['installed'] == true){
843+
//* Copy the ISPConfig vhost for the controlpanel
844+
// TODO: These are missing! should they be "vhost_dist_*_dir" ?
845+
$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
846+
$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
842847

843848

844-
// Dont just copy over the virtualhost template but add some custom settings
849+
// Dont just copy over the virtualhost template but add some custom settings
845850

846-
$content = rf("tpl/apache_ispconfig.vhost.master");
847-
$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
851+
$content = rf("tpl/apache_ispconfig.vhost.master");
852+
$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
853+
854+
// comment out the listen directive if port is 80 or 443
855+
if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
856+
$content = str_replace('{vhost_port_listen}', '#', $content);
857+
} else {
858+
$content = str_replace('{vhost_port_listen}', '', $content);
859+
}
848860

849-
// comment out the listen directive if port is 80 or 443
850-
if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
851-
$content = str_replace('{vhost_port_listen}', '#', $content);
852-
} else {
853-
$content = str_replace('{vhost_port_listen}', '', $content);
854-
}
861+
if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) {
862+
$content = str_replace('{ssl_comment}', '', $content);
863+
} else {
864+
$content = str_replace('{ssl_comment}', '#', $content);
865+
}
855866

856-
if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) {
857-
$content = str_replace('{ssl_comment}', '', $content);
858-
} else {
859-
$content = str_replace('{ssl_comment}', '#', $content);
860-
}
867+
$content = str_replace('/var/www/', '/srv/www/', $content);
861868

862-
$content = str_replace('/var/www/', '/srv/www/', $content);
869+
wf("$vhost_conf_dir/ispconfig.vhost", $content);
863870

864-
wf("$vhost_conf_dir/ispconfig.vhost", $content);
871+
if(!is_file('/srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
872+
exec('mkdir -p /srv/www/php-fcgi-scripts/ispconfig');
873+
exec('cp tpl/apache_ispconfig_fcgi_starter.master /srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
874+
exec('chmod +x /srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
875+
exec('ln -s /usr/local/ispconfig/interface/web /srv/www/ispconfig');
876+
exec('chown -R ispconfig:ispconfig /srv/www/php-fcgi-scripts/ispconfig');
877+
878+
}
865879

866-
if(!is_file('/srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
867-
exec('mkdir -p /srv/www/php-fcgi-scripts/ispconfig');
868-
exec('cp tpl/apache_ispconfig_fcgi_starter.master /srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
869-
exec('chmod +x /srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
870-
exec('ln -s /usr/local/ispconfig/interface/web /srv/www/ispconfig');
871-
exec('chown -R ispconfig:ispconfig /srv/www/php-fcgi-scripts/ispconfig');
880+
//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
881+
//* and create the symlink
882+
if($this->install_ispconfig_interface == true && $this->is_update == false) {
883+
if(@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
884+
if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
885+
exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
886+
}
872887

873-
}
888+
}
874889

875-
//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
876-
//* and create the symlink
877-
if($this->install_ispconfig_interface == true && $this->is_update == false) {
878-
if(@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
879-
if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
880-
exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
890+
// Fix a setting in vhost master file for suse
891+
replaceLine('/usr/local/ispconfig/server/conf/vhost.conf.master',"suPHP_UserGroup"," suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>",0);
892+
}
893+
894+
if($conf['nginx']['installed'] == true){
895+
//* Copy the ISPConfig vhost for the controlpanel
896+
$vhost_conf_dir = $conf['nginx']['vhost_conf_dir'];
897+
$vhost_conf_enabled_dir = $conf['nginx']['vhost_conf_enabled_dir'];
898+
899+
// Dont just copy over the virtualhost template but add some custom settings
900+
$content = rf('tpl/nginx_ispconfig.vhost.master');
901+
$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
902+
903+
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
904+
$content = str_replace('{ssl_on}', ' ssl', $content);
905+
$content = str_replace('{ssl_comment}', '', $content);
906+
$content = str_replace('{fastcgi_ssl}', 'on', $content);
907+
} else {
908+
$content = str_replace('{ssl_on}', '', $content);
909+
$content = str_replace('{ssl_comment}', '#', $content);
910+
$content = str_replace('{fastcgi_ssl}', 'off', $content);
881911
}
882912

913+
$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
914+
915+
wf($vhost_conf_dir.'/ispconfig.vhost', $content);
916+
917+
unset($content);
918+
919+
// PHP-FPM
920+
// Dont just copy over the php-fpm pool template but add some custom settings
921+
$content = rf('tpl/php_fpm_pool.conf.master');
922+
$content = str_replace('{fpm_pool}', 'ispconfig', $content);
923+
$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
924+
$content = str_replace('{fpm_user}', 'ispconfig', $content);
925+
$content = str_replace('{fpm_group}', 'ispconfig', $content);
926+
wf($conf['nginx']['php_fpm_pool_dir'].'/ispconfig.conf', $content);
927+
928+
//copy('tpl/nginx_ispconfig.vhost.master', $vhost_conf_dir.'/ispconfig.vhost');
929+
//* and create the symlink
930+
if($this->install_ispconfig_interface == true && $this->is_update == false) {
931+
if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost');
932+
if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) {
933+
symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost');
934+
}
935+
}
883936
}
884937

885-
// Fix a setting in vhost master file for suse
886-
replaceLine('/usr/local/ispconfig/server/conf/vhost.conf.master',"suPHP_UserGroup"," suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>",0);
887-
888-
889938

890939
// Make the Clamav log files readable by ISPConfig
891940
//exec('chmod +r /var/log/clamav/clamav.log');

0 commit comments

Comments
 (0)