mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
refactoring (#116)
- refactoring architecture - fix incomplete ssh logs - code editor for scripts in the app - remove Jobs and SSHCommands
This commit is contained in:
@ -15,7 +15,6 @@
|
||||
* @property string $disk
|
||||
* @property Server $server
|
||||
* @property ?Site $site
|
||||
* @property string $content
|
||||
*/
|
||||
class ServerLog extends AbstractModel
|
||||
{
|
||||
@ -72,7 +71,7 @@ public function write($buf): void
|
||||
}
|
||||
}
|
||||
|
||||
public function getContentAttribute(): ?string
|
||||
public function getContent(): ?string
|
||||
{
|
||||
if (Storage::disk($this->disk)->exists($this->name)) {
|
||||
return Storage::disk($this->disk)->get($this->name);
|
||||
@ -80,4 +79,17 @@ public function getContentAttribute(): ?string
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function log(Server $server, string $type, string $content, ?Site $site = null): void
|
||||
{
|
||||
$log = new static([
|
||||
'server_id' => $server->id,
|
||||
'site_id' => $site?->id,
|
||||
'name' => $server->id.'-'.strtotime('now').'-'.$type.'.log',
|
||||
'type' => $type,
|
||||
'disk' => config('core.logs_disk'),
|
||||
]);
|
||||
$log->save();
|
||||
$log->write($content);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user