44
55use App \MasterDomain ;
66use App \Models \Domain ;
7+ use App \Models \HostingSubscription ;
78use Illuminate \Bus \Queueable ;
89use Illuminate \Contracts \Queue \ShouldQueue ;
910use Illuminate \Foundation \Bus \Dispatchable ;
1011use Illuminate \Queue \InteractsWithQueue ;
1112use Illuminate \Queue \SerializesModels ;
13+ use Modules \Microweber \App \Models \MicroweberInstallation ;
1214
1315class CaddyBuild implements ShouldQueue
1416{
@@ -197,7 +199,26 @@ protected function generateCaddyfile(): void
197199 shell_exec ("sudo setfacl -R -m u:caddy:rx " . $ domain ->document_root );
198200 shell_exec ("sudo setfacl -R -m u:caddy:rx " . $ domain ->domain_public );
199201 shell_exec ("sudo setfacl -R -m u:caddy:rx " . $ domain ->home_root );
200- //
202+
203+
204+ /* //fix permissions
205+ shell_exec('chown -R ' . $chown_user . ':' . $chown_user . ' ' . $chown_path);
206+
207+ // chmod
208+ shell_exec('chmod -R 755 ' . $chown_path);*/
209+
210+ $ findHostingSubscription = HostingSubscription::where ('id ' , $ domain ->id )->first ();
211+
212+ $ chown_user = $ findHostingSubscription ->system_username ;
213+
214+ $ chown_path = $ domain ->home_root ;
215+ //fix permissions
216+ // shell_exec('chown -R ' . $chown_user . ':' . $chown_user . ' ' . $chown_path);
217+
218+ // chmod
219+ // shell_exec('chmod -R 755 ' . $chown_path);
220+
221+
201222
202223 // Check current permissions using getfacl
203224// $homeRootPerms = shell_exec("getfacl " . escapeshellarg($domain->home_root));
@@ -218,6 +239,9 @@ protected function generateCaddyfile(): void
218239 shell_exec ("chmod o+x {$ domain ->home_root }" );
219240 shell_exec ("chmod -R o+rX {$ domain ->document_root }" );
220241
242+
243+
244+
221245 if (!file_exists ($ domainLog )) {
222246 // Create log file for the domain if it doesn't exist
223247 touch ($ domainLog );
0 commit comments