@@ -212,10 +212,11 @@ function update($event_name,$data) {
212212
213213 // Check if the directories are there and create them if nescessary.
214214 if (!is_dir ($ data ["new " ]["document_root " ]."/web " )) exec ("mkdir -p " .$ data ["new " ]["document_root " ]."/web " );
215- if (!is_dir ($ data ["new " ]["document_root " ]."/web/error " )) exec ("mkdir -p " .$ data ["new " ]["document_root " ]."/web/error " );
215+ if (!is_dir ($ data ["new " ]["document_root " ]."/web/error " ) and $ data [ " new " ][ " is_errordocs " ] ) exec ("mkdir -p " .$ data ["new " ]["document_root " ]."/web/error " );
216216 //if(!is_dir($data["new"]["document_root"]."/log")) exec("mkdir -p ".$data["new"]["document_root"]."/log");
217217 if (!is_dir ($ data ["new " ]["document_root " ]."/ssl " )) exec ("mkdir -p " .$ data ["new " ]["document_root " ]."/ssl " );
218218 if (!is_dir ($ data ["new " ]["document_root " ]."/cgi-bin " )) exec ("mkdir -p " .$ data ["new " ]["document_root " ]."/cgi-bin " );
219+ if (!is_dir ($ data ["new " ]["document_root " ]."/tmp " )) exec ("mkdir -p " .$ data ["new " ]["document_root " ]."/tmp " );
219220
220221 // Remove the symlink for the site, if site is renamed
221222 if ($ this ->action == 'update ' && $ data ["old " ]["domain " ] != '' && $ data ["new " ]["domain " ] != $ data ["old " ]["domain " ]) {
@@ -287,10 +288,12 @@ function update($event_name,$data) {
287288
288289 if ($ this ->action == 'insert ' && $ data ["new " ]["type " ] == 'vhost ' ) {
289290 // Copy the error pages
290- $ error_page_path = escapeshellcmd ($ data ["new " ]["document_root " ])."/web/error/ " ;
291- exec ("cp /usr/local/ispconfig/server/conf/error/ " .substr (escapeshellcmd ($ conf ["language " ]),0 ,2 )."/* " .$ error_page_path );
292- exec ("chmod -R +r " .$ error_page_path );
293-
291+ if ($ data ["new " ]["is_errordocs " ]){
292+ $ error_page_path = escapeshellcmd ($ data ["new " ]["document_root " ])."/web/error/ " ;
293+ exec ("cp /usr/local/ispconfig/server/conf/error/ " .substr (escapeshellcmd ($ conf ["language " ]),0 ,2 )."/* " .$ error_page_path );
294+ exec ("chmod -R +r " .$ error_page_path );
295+ }
296+
294297 // copy the standard index page
295298 exec ("cp /usr/local/ispconfig/server/conf/index/standard_index.html_ " .substr (escapeshellcmd ($ conf ["language " ]),0 ,2 )." " .escapeshellcmd ($ data ["new " ]["document_root " ])."/web/index.html " );
296299 exec ("chmod +r " .escapeshellcmd ($ data ["new " ]["document_root " ])."/web/index.html " );
@@ -369,10 +372,14 @@ function update($event_name,$data) {
369372
370373 // get alias domains (co-domains and subdomains)
371374 $ aliases = $ app ->db ->queryAllRecords ("SELECT * FROM web_domain WHERE parent_domain_id = " .$ data ["new " ]["domain_id " ]." AND active = 'y' " );
372- $ server_alias = '' ;
375+ if ($ data ["new " ]["is_subdomainwww " ]){
376+ $ server_alias .= 'www. ' .$ data ["new " ]["domain " ].' ' ;
377+ } else {
378+ $ server_alias = '' ;
379+ }
373380 if (is_array ($ aliases )) {
374381 foreach ($ aliases as $ alias ) {
375- $ server_alias .= $ alias ["domain " ].' ' ;
382+ $ server_alias .= $ alias ["domain " ].' ' ;
376383 $ app ->log ("Add server alias: $ alias [domain]" ,LOGLEVEL_DEBUG );
377384 // Rewriting
378385 if ($ alias ["redirect_type " ] != '' ) {
0 commit comments