Skip to content

Commit

Permalink
Update GitRepository.php
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Oct 1, 2024
1 parent 5db9264 commit f8efe85
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions web/app/Models/GitRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,25 @@ public function clone()

file_put_contents($shellFile, $shellContent);

shell_exec('chmod +x ' . $shellFile);
shell_exec('chown '.$findHostingSubscription->system_username.':'.$findHostingSubscription->system_username.' ' . $shellFile);

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.' &"');
$gitExecutorTempPath = storage_path('app/git/tmp');
shell_exec('mkdir -p ' . $gitExecutorTempPath);

$gitExecutorShellFile = $gitExecutorTempPath . '/git-clone-' . $this->id . '.sh';
$gitExecutorShellFileLog = $gitExecutorTempPath . '/git-clone-' . $this->id . '.log';

$gitExecutorContent = view('actions.git.git-executor', [
'shellFile' => $shellFile,
'shellLog' => $shellLog,
'systemUsername' => $findHostingSubscription->system_username,
'selfFile' => $gitExecutorShellFile,
'afterCommand' => 'phyre-php /usr/local/phyre/web/artisan git-repository:mark-as-cloned '.$this->id,
])->render();

file_put_contents($gitExecutorShellFile, $gitExecutorContent);

shell_exec('chmod +x ' . $gitExecutorShellFile);
shell_exec('bash ' . $gitExecutorShellFile . ' >> ' . $gitExecutorShellFileLog . ' &');

}

Expand Down

0 comments on commit f8efe85

Please sign in to comment.