@@ -166,10 +166,24 @@ public function pull()
166
166
167
167
file_put_contents ($ shellFile , $ shellContent );
168
168
169
- shell_exec ('chmod +x ' . $ shellFile );
170
- shell_exec ('chown ' .$ findHostingSubscription ->system_username .': ' .$ findHostingSubscription ->system_username .' ' . $ shellFile );
171
169
172
- shell_exec ('su -m ' . $ findHostingSubscription ->system_username . ' -c "bash ' .$ shellFile .' >> ' . $ shellLog . ' &" ' );
170
+ $ gitExecutorTempPath = storage_path ('app/git/tmp ' );
171
+ shell_exec ('mkdir -p ' . $ gitExecutorTempPath );
172
+
173
+ $ gitExecutorShellFile = $ gitExecutorTempPath . '/git-pull- ' . $ this ->id . '.sh ' ;
174
+ $ gitExecutorShellFileLog = $ gitExecutorTempPath . '/git-pull- ' . $ this ->id . '.log ' ;
175
+
176
+ $ gitExecutorContent = view ('actions.git.git-executor ' , [
177
+ 'shellFile ' => $ shellFile ,
178
+ 'systemUsername ' => $ findHostingSubscription ->system_username ,
179
+ 'selfFile ' => $ gitExecutorShellFile ,
180
+ 'afterCommand ' => 'phyre-php /usr/local/phyre/web/artisan git-repository:mark-as-pulled ' .$ this ->id ,
181
+ ])->render ();
182
+
183
+ file_put_contents ($ gitExecutorShellFile , $ gitExecutorContent );
184
+
185
+ shell_exec ('chmod +x ' . $ gitExecutorShellFile );
186
+ shell_exec ('bash ' . $ gitExecutorShellFile . ' >> ' . $ gitExecutorShellFileLog . ' & ' );
173
187
174
188
}
175
189
@@ -234,7 +248,7 @@ public function clone()
234
248
shell_exec ('chmod +x ' . $ shellFile );
235
249
shell_exec ('chown ' .$ findHostingSubscription ->system_username .': ' .$ findHostingSubscription ->system_username .' ' . $ shellFile );
236
250
237
- shell_exec ('su -m ' . $ findHostingSubscription ->system_username . ' -c "bash ' .$ shellFile .' >> ' . $ shellLog . ' &" ' );
251
+ shell_exec ('su -m ' . $ findHostingSubscription ->system_username . ' -c "bash ' .$ shellFile .' >> ' . $ shellLog . ' && phyre-php /usr/local/phyre/web/artisan git-repository:mark-as-cloned ' . $ this -> id . ' & " ' );
238
252
239
253
}
240
254
0 commit comments