@@ -451,14 +451,14 @@ function update($event_name,$data) {
451451 $ app ->system ->chgrp ($ data ['new ' ]['document_root ' ].'/private ' ,$ groupname );
452452 }
453453
454- $ app ->system ->web_folder_protection ($ data ['new ' ]['document_root ' ],true );
455454
456455 // Remove the symlink for the site, if site is renamed
457456 if ($ this ->action == 'update ' && $ data ['old ' ]['domain ' ] != '' && $ data ['new ' ]['domain ' ] != $ data ['old ' ]['domain ' ]) {
458457 if (is_dir ('/var/log/ispconfig/httpd/ ' .$ data ['old ' ]['domain ' ])) exec ('rm -rf /var/log/ispconfig/httpd/ ' .$ data ['old ' ]['domain ' ]);
459458 if (is_link ($ data ['old ' ]['document_root ' ].'/log ' )) $ app ->system ->unlink ($ data ['old ' ]['document_root ' ].'/log ' );
460459 }
461-
460+
461+ /*
462462 // Create the symlink for the logfiles
463463 if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) $app->system->mkdirpath('/var/log/ispconfig/httpd/'.$data['new']['domain']);
464464 if(!is_link($data['new']['document_root'].'/log')) {
@@ -471,6 +471,22 @@ function update($event_name,$data) {
471471
472472 $app->log('Creating symlink: ln -s /var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/log',LOGLEVEL_DEBUG);
473473 }
474+ */
475+
476+ //* Create the log dir if nescessary and mount it
477+ if (!is_dir ($ data ['new ' ]['document_root ' ].'/log ' ) || is_link ($ data ['new ' ]['document_root ' ].'/log ' )) {
478+ if (is_link ($ data ['new ' ]['document_root ' ].'/log ' )) unlink ($ data ['new ' ]['document_root ' ].'/log ' );
479+ $ app ->system ->mkdir ($ data ['new ' ]['document_root ' ].'/log ' );
480+ $ app ->system ->chown ($ data ['new ' ]['document_root ' ].'/log ' ,'root ' );
481+ $ app ->system ->chgrp ($ data ['new ' ]['document_root ' ].'/log ' ,'root ' );
482+ $ app ->system ->chmod ($ data ['new ' ]['document_root ' ].'/log ' ,0755 );
483+ exec ('mount --bind ' .escapeshellarg ('/var/log/ispconfig/httpd/ ' .$ data ['new ' ]['domain ' ]).' ' .escapeshellarg ($ data ['new ' ]['document_root ' ].'/log ' ));
484+ //* add mountpoint to fstab
485+ $ fstab_line = '/var/log/ispconfig/httpd/ ' .$ data ['new ' ]['domain ' ].' ' .$ data ['new ' ]['document_root ' ].'/log none bind 0 0 ' ;
486+ $ app ->system ->replaceLine ('/etc/fstab ' ,$ fstab_line ,$ fstab_line ,1 ,1 );
487+ }
488+
489+ $ app ->system ->web_folder_protection ($ data ['new ' ]['document_root ' ],true );
474490
475491 // Get the client ID
476492 $ client = $ app ->dbmaster ->queryOneRecord ('SELECT client_id FROM sys_group WHERE sys_group.groupid = ' .intval ($ data ['new ' ]['sys_groupid ' ]));
0 commit comments