From 81d79a79e4b29e9314b64b2e4c49b48ae8319767 Mon Sep 17 00:00:00 2001 From: ftimme <ft@falkotimme.com> Date: Tue, 11 Oct 2011 08:50:45 -0400 Subject: [PATCH] - WebDAV Users: show only domains that run on Apache (because nginx does not have full WebDAV support). --- install/lib/update.lib.php | 63 +++++++++++++++++++++++++++++-- 1 files changed, 58 insertions(+), 5 deletions(-) diff --git a/install/lib/update.lib.php b/install/lib/update.lib.php index 4cc7355..d95bbf8 100644 --- a/install/lib/update.lib.php +++ b/install/lib/update.lib.php @@ -79,6 +79,32 @@ } } +function checkDbHealth() { + global $conf; + + //* Array containing non OK tables (can be repaired, crashed, corrupt) + $notok = array(); + + echo "Checking ISPConfig database .. "; + exec("mysqlcheck -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' -r ".$conf["mysql"]["database"], $result); + for( $i=0; $i<sizeof($result);$i++) { + if ( substr($result[$i], -2) != "OK" ) { + $notok[] = $result[$i]; + } + } + + if ( sizeof($notok) > 0 ) { + echo "\nSome tables where not 'OK'. Please check the list below.\n\n"; + foreach ($notok as $key => $value) { + echo "$value\n"; + } + echo "\nPress enter to continue or CTRL-C to cancel the installation .."; + sread(); + } + else + echo "OK\n"; +} + function updateDbAndIni() { global $inst, $conf; @@ -95,10 +121,22 @@ $conf['services']['file'] = ($tmp['file_server'] == 1)?true:false; $conf['services']['db'] = ($tmp['db_server'] == 1)?true:false; $conf['services']['vserver'] = ($tmp['vserver_server'] == 1)?true:false; - $conf['services']['proxy'] = ($tmp['proxy_server'] == 1)?true:false; - $conf['services']['firewall'] = ($tmp['firewall_server'] == 1)?true:false; + $conf['services']['proxy'] = (isset($tmp['proxy_server']) && $tmp['proxy_server'] == 1)?true:false; + $conf['services']['firewall'] = (isset($tmp['firewall_server']) && $tmp['firewall_server'] == 1)?true:false; $conf['postfix']['vmail_mailbox_base'] = $ini_array['mail']['homedir_path']; + + if(isset($ini_array['web']['server_type']) && $ini_array['web']['server_type'] != ''){ + $conf['webserver']['server_type'] = $ini_array['web']['server_type']; + if($conf['webserver']['server_type'] == 'nginx'){ + $conf['apache']['installed'] = false; + } else { + $conf['nginx']['installed'] = false; + } + } else { + $conf['webserver']['server_type'] = 'apache'; + $conf['nginx']['installed'] = false; + } //* Do incremental DB updates only on installed ISPConfig versions > 3.0.3 if(compare_ispconfig_version('3.0.3',ISPC_APP_VERSION) >= 0) { @@ -200,8 +238,6 @@ //* Update further distribution specific parameters for server config here //* HINT: Every line added here has to be added in installer_base.lib.php too!! - $tpl_ini_array['web']['vhost_conf_dir'] = $conf['apache']['vhost_conf_dir']; - $tpl_ini_array['web']['vhost_conf_enabled_dir'] = $conf['apache']['vhost_conf_enabled_dir']; $tpl_ini_array['jailkit']['jailkit_chroot_app_programs'] = $conf['jailkit']['jailkit_chroot_app_programs']; $tpl_ini_array['fastcgi']['fastcgi_phpini_path'] = $conf['fastcgi']['fastcgi_phpini_path']; $tpl_ini_array['fastcgi']['fastcgi_starter_path'] = $conf['fastcgi']['fastcgi_starter_path']; @@ -223,6 +259,22 @@ $tpl_ini_array['dns']['bind_zonefiles_dir'] = $conf['bind']['bind_zonefiles_dir']; $tpl_ini_array['dns']['named_conf_path'] = $conf['bind']['named_conf_path']; $tpl_ini_array['dns']['named_conf_local_path'] = $conf['bind']['named_conf_local_path']; + + $tpl_ini_array['web']['nginx_vhost_conf_dir'] = $conf['nginx']['vhost_conf_dir']; + $tpl_ini_array['web']['nginx_vhost_conf_enabled_dir'] = $conf['nginx']['vhost_conf_enabled_dir']; + $tpl_ini_array['web']['nginx_user'] = $conf['nginx']['user']; + $tpl_ini_array['web']['nginx_group'] = $conf['nginx']['group']; + $tpl_ini_array['web']['nginx_cgi_socket'] = $conf['nginx']['cgi_socket']; + $tpl_ini_array['web']['php_fpm_init_script'] = $conf['nginx']['php_fpm_init_script']; + $tpl_ini_array['web']['php_fpm_ini_path'] = $conf['nginx']['php_fpm_ini_path']; + $tpl_ini_array['web']['php_fpm_pool_dir'] = $conf['nginx']['php_fpm_pool_dir']; + $tpl_ini_array['web']['php_fpm_start_port'] = $conf['nginx']['php_fpm_start_port']; + $tpl_ini_array['web']['php_fpm_socket_dir'] = $conf['nginx']['php_fpm_socket_dir']; + + if ($conf['nginx']['installed'] == true) { + $tpl_ini_array['web']['server_type'] = 'nginx'; + $tpl_ini_array['global']['webserver'] = 'nginx'; + } // update the new template with the old values if(is_array($old_ini_array)) { @@ -234,7 +286,8 @@ } $new_ini = array_to_ini($tpl_ini_array); - $inst->db->query("UPDATE server SET config = '".mysql_real_escape_string($new_ini)."' WHERE server_id = ".$conf['server_id']); + $sql = "UPDATE server SET config = '".mysql_real_escape_string($new_ini)."' WHERE server_id = ".$conf['server_id']; + $inst->db->query($sql); unset($old_ini_array); unset($tpl_ini_array); unset($new_ini); -- Gitblit v1.9.1