@@ -226,8 +226,15 @@ public function reconfigure_app($service, $reconfigure_services_answer) {
226226 public function configure_database () {
227227 global $ conf ;
228228
229- //* ensure no modes with errors for ENGINE=MyISAM
230- $ this ->db ->query ("SET sql_mode = '' " );
229+ //* check sql-mode
230+ /*$check_sql_mode = $this->db->queryOneRecord("SELECT @@sql_mode");
231+
232+ if ($check_sql_mode['@@sql_mode'] != '' && $check_sql_mode['@@sql_mode'] != 'NO_ENGINE_SUBSTITUTION') {
233+ echo "Wrong SQL-mode. You should use NO_ENGINE_SUBSTITUTION. Add\n\n";
234+ echo " sql-mode=\"NO_ENGINE_SUBSTITUTION\"\n\n";
235+ echo"to the mysqld-section in your mysql-config on this server and restart mysqld afterwards\n";
236+ die();
237+ }*/
231238
232239 $ unwanted_sql_plugins = array ('validate_password ' );
233240 $ sql_plugins = $ this ->db ->queryAllRecords ("SELECT plugin_name FROM information_schema.plugins WHERE plugin_status='ACTIVE' AND plugin_name IN ? " , $ unwanted_sql_plugins );
@@ -250,10 +257,10 @@ public function configure_database() {
250257 $ this ->error ('Stopped: Database already contains some tables. ' );
251258 } else {
252259 if ($ conf ['mysql ' ]['admin_password ' ] == '' ) {
253- caselog ("mysql --default-character-set= " .escapeshellarg ($ conf ['mysql ' ]['charset ' ])." -h " .escapeshellarg ($ conf ['mysql ' ]['host ' ])." -u " .escapeshellarg ($ conf ['mysql ' ]['admin_user ' ])." " .escapeshellarg ($ conf ['mysql ' ]['database ' ])." < ' " .ISPC_INSTALL_ROOT ."/install/sql/ispconfig3.sql' &> /dev/null " ,
260+ caselog ("mysql --default-character-set= " .escapeshellarg ($ conf ['mysql ' ]['charset ' ])." -h " .escapeshellarg ($ conf ['mysql ' ]['host ' ])." -u " .escapeshellarg ($ conf ['mysql ' ]['admin_user ' ])." -P " . escapeshellarg ( $ conf [ ' mysql ' ][ ' port ' ]). " " .escapeshellarg ($ conf ['mysql ' ]['database ' ])." < ' " .ISPC_INSTALL_ROOT ."/install/sql/ispconfig3.sql' &> /dev/null " ,
254261 __FILE__ , __LINE__ , 'read in ispconfig3.sql ' , 'could not read in ispconfig3.sql ' );
255262 } else {
256- caselog ("mysql --default-character-set= " .escapeshellarg ($ conf ['mysql ' ]['charset ' ])." -h " .escapeshellarg ($ conf ['mysql ' ]['host ' ])." -u " .escapeshellarg ($ conf ['mysql ' ]['admin_user ' ])." -p " .escapeshellarg ($ conf ['mysql ' ]['admin_password ' ])." " .escapeshellarg ($ conf ['mysql ' ]['database ' ])." < ' " .ISPC_INSTALL_ROOT ."/install/sql/ispconfig3.sql' &> /dev/null " ,
263+ caselog ("mysql --default-character-set= " .escapeshellarg ($ conf ['mysql ' ]['charset ' ])." -h " .escapeshellarg ($ conf ['mysql ' ]['host ' ])." -u " .escapeshellarg ($ conf ['mysql ' ]['admin_user ' ])." -p " .escapeshellarg ($ conf ['mysql ' ]['admin_password ' ])." -P " . escapeshellarg ( $ conf [ ' mysql ' ][ ' port ' ]). " " .escapeshellarg ($ conf ['mysql ' ]['database ' ])." < ' " .ISPC_INSTALL_ROOT ."/install/sql/ispconfig3.sql' &> /dev/null " ,
257264 __FILE__ , __LINE__ , 'read in ispconfig3.sql ' , 'could not read in ispconfig3.sql ' );
258265 }
259266 $ db_tables = $ this ->db ->getTables ();
@@ -1981,6 +1988,14 @@ public function configure_apache() {
19811988 $ vhost_conf_enabled_dir = $ conf ['apache ' ]['vhost_conf_enabled_dir ' ];
19821989
19831990 $ tpl = new tpl ('apache_ispconfig.conf.master ' );
1991+ $ tpl ->setVar ('apache_version ' ,getapacheversion ());
1992+
1993+ if ($ this ->is_update == true ) {
1994+ $ tpl ->setVar ('logging ' ,get_logging_state ());
1995+ } else {
1996+ $ tpl ->setVar ('logging ' ,'yes ' );
1997+ }
1998+
19841999 $ tpl ->setVar ('apache_version ' ,getapacheversion (true ));
19852000
19862001 $ records = $ this ->db ->queryAllRecords ("SELECT * FROM ?? WHERE server_id = ? AND virtualhost = 'y' " , $ conf ['mysql ' ]['master_database ' ] . '.server_ip ' , $ conf ['server_id ' ]);
@@ -2066,6 +2081,17 @@ public function configure_nginx(){
20662081 //* add a sshusers group
20672082 $ command = 'groupadd sshusers ' ;
20682083 if (!is_group ('sshusers ' )) caselog ($ command .' &> /dev/null 2> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
2084+
2085+ // add anonymized log option to nginxx.conf file
2086+ $ nginx_conf_file = $ conf ['nginx ' ]['config_dir ' ].'/nginx.conf ' ;
2087+ if (is_file ($ nginx_conf_file )) {
2088+ $ tmp = file_get_contents ($ nginx_conf_file );
2089+ if (!stristr ($ tmp , 'log_format anonymized ' )) {
2090+ copy ($ nginx_conf_file ,$ nginx_conf_file .'~ ' );
2091+ replaceLine ($ nginx_conf_file , 'http { ' , "http { \n\n" .file_get_contents ('tpl/nginx_anonlog.master ' ), 0 , 0 );
2092+ }
2093+ }
2094+
20692095 }
20702096
20712097 public function configure_fail2ban () {
@@ -2239,6 +2265,11 @@ public function configure_apps_vhost() {
22392265 $ tpl ->setVar ('apps_vhost_basedir ' ,$ conf ['web ' ]['website_basedir ' ]);
22402266 $ tpl ->setVar ('apps_vhost_servername ' ,$ apps_vhost_servername );
22412267 $ tpl ->setVar ('apache_version ' ,getapacheversion ());
2268+ if ($ this ->is_update == true ) {
2269+ $ tpl ->setVar ('logging ' ,get_logging_state ());
2270+ } else {
2271+ $ tpl ->setVar ('logging ' ,'yes ' );
2272+ }
22422273
22432274
22442275 // comment out the listen directive if port is 80 or 443
@@ -2322,7 +2353,12 @@ public function configure_apps_vhost() {
23222353 $ content = str_replace ('{fpm_socket} ' , $ fpm_socket , $ content );
23232354 $ content = str_replace ('{cgi_socket} ' , $ cgi_socket , $ content );
23242355
2325- if (file_exists ('/var/run/php5-fpm.sock ' ) || file_exists ('/var/run/php/php7.0-fpm.sock ' )){
2356+ if ( file_exists ('/var/run/php5-fpm.sock ' )
2357+ || file_exists ('/var/run/php/php7.0-fpm.sock ' )
2358+ || file_exists ('/var/run/php/php7.1-fpm.sock ' )
2359+ || file_exists ('/var/run/php/php7.2-fpm.sock ' )
2360+ || file_exists ('/var/run/php/php7.3-fpm.sock ' )
2361+ ){
23262362 $ use_tcp = '# ' ;
23272363 $ use_socket = '' ;
23282364 } else {
0 commit comments