This commit is contained in:
Bozhidar 2024-09-11 16:56:32 +03:00
parent 74360aee69
commit 139a20a584
2 changed files with 13 additions and 9 deletions

View file

@ -136,7 +136,7 @@ class CustomerResource extends Resource
Impersonate::make('impersonate')
->guard('web_customer')
->redirectTo(route('filament.customer::admin.pages.dashboard')),
->redirectTo(route('filament.customer::admin.resources.domains.index')),
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),

View file

@ -124,29 +124,33 @@ class GitRepository extends Model
$shellCommand = [];
$shellCommand[] = 'echo "Cloning started at $(date)"';
$shellCommand[] = 'export HOME=/home/'.$findHostingSubscription->system_username;
// $shellCommand[] = 'cd '.$findDomain->domain_root;
$exportHomeCommand = 'export HOME=/home/'.$findHostingSubscription->system_username;
$shellCommand[] = 'su -m '.$findHostingSubscription->system_username.' -c "'.$exportHomeCommand.'"';
if ($gitSSHKey) {
$cloneUrl = 'git@'.$gitSSHUrl['provider'].':'.$gitSSHUrl['owner'].'/'.$gitSSHUrl['name'].'.git';
$shellCommand[] = 'git -c core.sshCommand="ssh -i '.$privateKeyFile .'" clone '.$cloneUrl.' '.$projectDir . ' 2>&1';
$gitCloneCommand = 'git -c core.sshCommand="ssh -i '.$privateKeyFile .'" clone '.$cloneUrl.' '.$projectDir . ' 2>&1';
} else {
$gitCloneCommand = 'git clone '.$this->url.' '.$projectDir . ' 2>&1';
$shellCommand[] = 'su -m '.$findHostingSubscription->system_username.' -c "'.$gitCloneCommand.'"';
}
$shellCommand[] = 'su -m '.$findHostingSubscription->system_username.' -c "'.$gitCloneCommand.'"';
$shellCommand[] = 'phyre-php /usr/local/phyre/web/artisan git-repository:mark-as-cloned '.$this->id;
$shellFile = '/tmp/git-clone-' . $this->id . '.sh';
$shellLog = '/tmp/git-clone-' . $this->id . '.log';
$shellCommand[] = 'rm -rf ' . $shellFile;
$shellContent = '';
foreach ($shellCommand as $command) {
$shellContent .= $command . "\n";
}
$shellFile = '/tmp/git-clone-' . $this->id . '.sh';
$shellLog = '/tmp/git-clone-' . $this->id . '.log';
file_put_contents($shellFile, $shellContent);
file_put_contents($shellLog, 'Clone started at ' . date('Y-m-d H:i:s') . "\n");
shell_exec('chmod +x ' . $shellFile);
shell_exec('bash '.$shellFile.' >> ' . $shellLog . ' &');