@@ -238,6 +238,7 @@ function update($event_name,$data) {
238238 //* Check if this is a chrooted setup
239239 if ($ web_config ['website_basedir ' ] != '' && @is_file ($ web_config ['/var/www ' ].'/etc/passwd ' )) {
240240 $ apache_chrooted = true ;
241+ $ app ->log ("Info: Apache is chrooted. " ,LOGLEVEL_DEBUG );
241242 } else {
242243 $ apache_chrooted = false ;
243244 }
@@ -299,7 +300,7 @@ function update($event_name,$data) {
299300 $ command .= ' ' .escapeshellcmd ($ data ["new " ]["system_user " ]);
300301 exec ($ command );
301302
302- if ($ apache_chrooted ) exec ("chroot " .escapeshellcmd ($ web_config ['website_basedir ' ])." " .$ command );
303+ if ($ apache_chrooted ) $ this -> _exec ("chroot " .escapeshellcmd ($ web_config ['website_basedir ' ])." " .$ command );
303304
304305
305306 }
@@ -445,14 +446,14 @@ function update($event_name,$data) {
445446 $ groupname = escapeshellcmd ($ data ["new " ]["system_group " ]);
446447 if ($ data ["new " ]["system_group " ] != '' && !$ app ->system ->is_group ($ data ["new " ]["system_group " ])) {
447448 exec ("groupadd $ groupname " );
448- if ($ apache_chrooted ) exec ("chroot " .escapeshellcmd ($ web_config ['website_basedir ' ])." groupadd $ groupname " );
449+ if ($ apache_chrooted ) $ this -> _exec ("chroot " .escapeshellcmd ($ web_config ['website_basedir ' ])." groupadd $ groupname " );
449450 $ app ->log ("Adding the group: $ groupname " ,LOGLEVEL_DEBUG );
450451 }
451452
452453 $ username = escapeshellcmd ($ data ["new " ]["system_user " ]);
453454 if ($ data ["new " ]["system_user " ] != '' && !$ app ->system ->is_user ($ data ["new " ]["system_user " ])) {
454455 exec ("useradd -d " .escapeshellcmd ($ data ["new " ]["document_root " ])." -g $ groupname -G sshusers $ username -s /bin/false " );
455- if ($ apache_chrooted ) exec ("chroot " .escapeshellcmd ($ web_config ['website_basedir ' ])." " ."useradd -d " .escapeshellcmd ($ data ["new " ]["document_root " ])." -g $ groupname -G sshusers $ username -s /bin/false " );
456+ if ($ apache_chrooted ) $ this -> _exec ("chroot " .escapeshellcmd ($ web_config ['website_basedir ' ])." " ."useradd -d " .escapeshellcmd ($ data ["new " ]["document_root " ])." -g $ groupname -G sshusers $ username -s /bin/false " );
456457 $ app ->log ("Adding the user: $ username " ,LOGLEVEL_DEBUG );
457458 }
458459
@@ -498,7 +499,7 @@ function update($event_name,$data) {
498499
499500 //* if we have a chrooted apache enviroment
500501 if ($ apache_chrooted ) {
501- exec ("chroot " .escapeshellcmd ($ web_config ['website_basedir ' ])." " .$ command );
502+ $ this -> _exec ("chroot " .escapeshellcmd ($ web_config ['website_basedir ' ])." " .$ command );
502503
503504 //* add the apache user to the client group in the chroot enviroment
504505 $ tmp_groupfile = $ app ->system ->server_conf ["group_datei " ];
@@ -814,9 +815,12 @@ function update($event_name,$data) {
814815 }
815816
816817
817-
818- // request a httpd reload when all records have been processed
819- $ app ->services ->restartServiceDelayed ('httpd ' ,'reload ' );
818+ if ($ apache_chrooted ) {
819+ $ app ->services ->restartServiceDelayed ('httpd ' ,'restart ' );
820+ } else {
821+ // request a httpd reload when all records have been processed
822+ $ app ->services ->restartServiceDelayed ('httpd ' ,'reload ' );
823+ }
820824
821825 //* Unset action to clean it for next processed vhost.
822826 $ this ->action = '' ;
@@ -916,7 +920,7 @@ function delete($event_name,$data) {
916920 $ command = 'userdel ' ;
917921 $ command .= ' ' .$ data ["old " ]["system_user " ];
918922 exec ($ command );
919- if ($ apache_chrooted ) exec ("chroot " .escapeshellcmd ($ web_config ['website_basedir ' ])." " .$ command );
923+ if ($ apache_chrooted ) $ this -> _exec ("chroot " .escapeshellcmd ($ web_config ['website_basedir ' ])." " .$ command );
920924
921925 }
922926 }
0 commit comments