mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-21 15:10:25 +00:00
update
This commit is contained in:
parent
058b71631e
commit
d1feb95eef
4 changed files with 38 additions and 3 deletions
|
@ -87,6 +87,14 @@ class GitRepositoryResource extends Resource
|
|||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
|
||||
Tables\Actions\Action::make('log')
|
||||
->label('Log')
|
||||
->form([
|
||||
Forms\Components\View::make('log')
|
||||
->view('filament.resources.git-repositories.log')
|
||||
]),
|
||||
|
||||
Tables\Actions\Action::make('pull')
|
||||
// ->hidden(fn (GitRepository $record) => $record->status !== 'cloned')
|
||||
->icon('heroicon-o-arrow-down-tray')
|
||||
|
|
|
@ -149,7 +149,7 @@ class GitRepository extends Model
|
|||
$cloneUrl = 'git@'.$gitSSHUrl['provider'].':'.$gitSSHUrl['owner'].'/'.$gitSSHUrl['name'].'.git';
|
||||
|
||||
$shellFile = $findDomain->domain_root . '/git/tmp/git-pull-' . $this->id . '.sh';
|
||||
$shellLog = $findDomain->domain_root . '/git/tmp/git-pull-' . $this->id . '.log';
|
||||
$shellLog = $findDomain->domain_root . '/git/tmp/git-action-' . $this->id . '.log';
|
||||
|
||||
shell_exec('mkdir -p ' . dirname($shellFile));
|
||||
shell_exec('chown '.$findHostingSubscription->system_username.':'.$findHostingSubscription->system_username.' -R ' . dirname(dirname($shellFile)));
|
||||
|
@ -175,6 +175,7 @@ class GitRepository extends Model
|
|||
|
||||
$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-pulled '.$this->id,
|
||||
|
@ -228,7 +229,7 @@ class GitRepository extends Model
|
|||
$cloneUrl = 'git@'.$gitSSHUrl['provider'].':'.$gitSSHUrl['owner'].'/'.$gitSSHUrl['name'].'.git';
|
||||
|
||||
$shellFile = $findDomain->domain_root . '/git/tmp/git-clone-' . $this->id . '.sh';
|
||||
$shellLog = $findDomain->domain_root . '/git/tmp/git-clone-' . $this->id . '.log';
|
||||
$shellLog = $findDomain->domain_root . '/git/tmp/git-action-' . $this->id . '.log';
|
||||
|
||||
shell_exec('mkdir -p ' . dirname($shellFile));
|
||||
shell_exec('chown '.$findHostingSubscription->system_username.':'.$findHostingSubscription->system_username.' -R ' . dirname(dirname($shellFile)));
|
||||
|
@ -252,4 +253,20 @@ class GitRepository extends Model
|
|||
|
||||
}
|
||||
|
||||
public function getLog()
|
||||
{
|
||||
$findDomain = Domain::find($this->domain_id);
|
||||
if (!$findDomain) {
|
||||
return 'Domain not found';
|
||||
}
|
||||
|
||||
$shellLog = $findDomain->domain_root . '/git/tmp/git-action-' . $this->id . '.log';
|
||||
if (file_exists($shellLog)) {
|
||||
$content = file_get_contents($shellLog);
|
||||
return nl2br($content);
|
||||
}
|
||||
|
||||
return 'No logs';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
chmod +x {{$shellFile}}
|
||||
chown {{$systemUsername}}:{{$systemUsername}} {{$shellFile}}
|
||||
|
||||
sudo -m {{$systemUsername}} -c "bash {{$shellFile}}"
|
||||
su -m {{$systemUsername}} -c "bash {{$shellFile}} > {{$shellLog}}"
|
||||
|
||||
@if ($afterCommand)
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<div>
|
||||
|
||||
@php
|
||||
$record = $getRecord();
|
||||
@endphp
|
||||
|
||||
{!! $record->getLog() !!}
|
||||
|
||||
|
||||
</div>
|
Loading…
Reference in a new issue