@@ -233,14 +233,15 @@ function update($event_name,$data) {
233233 return 0 ;
234234 }
235235
236+ //* If the client of the site has been changed, we have a change of the document root
236237 if ($ this ->action == 'update ' && $ data ["new " ]["document_root " ] != $ data ["old " ]["document_root " ]) {
237238
238- // Get the old client ID
239+ //* Get the old client ID
239240 $ old_client = $ app ->dbmaster ->queryOneRecord ("SELECT client_id FROM sys_group WHERE sys_group.groupid = " .intval ($ data ["old " ]["sys_groupid " ]));
240241 $ old_client_id = intval ($ old_client ["client_id " ]);
241242 unset($ old_client );
242243
243- // Remove the old symlinks
244+ //* Remove the old symlinks
244245 $ tmp_symlinks_array = explode (': ' ,$ web_config ["website_symlinks " ]);
245246 if (is_array ($ tmp_symlinks_array )) {
246247 foreach ($ tmp_symlinks_array as $ tmp_symlink ) {
@@ -256,6 +257,7 @@ function update($event_name,$data) {
256257 }
257258 }
258259
260+ //* Move the site data
259261 $ tmp_docroot = explode ('/ ' ,$ data ["new " ]["document_root " ]);
260262 unset($ tmp_docroot [count ($ tmp_docroot )-1 ]);
261263 $ new_dir = implode ('/ ' ,$ tmp_docroot );
@@ -269,8 +271,10 @@ function update($event_name,$data) {
269271 exec ('mv ' .$ data ["old " ]["document_root " ].' ' .$ new_dir );
270272 $ app ->log ("Moving site to new document root: " .'mv ' .$ data ["old " ]["document_root " ].' ' .$ new_dir ,LOGLEVEL_DEBUG );
271273
274+ //* Change the home directory and group of the website user
272275 $ command = 'usermod ' ;
273276 $ command .= ' --home ' .escapeshellcmd ($ data ["new " ]["document_root " ]);
277+ $ command .= ' --gid ' .escapeshellcmd ($ data ['new ' ]['system_group ' ]);
274278 $ command .= ' ' .escapeshellcmd ($ data ["new " ]["system_user " ]);
275279 exec ($ command );
276280
0 commit comments